django create app in subdir

To create a "polls" app in the "apps" sub-directory, do the following first to make the directory (assuming you are at the root of your django project):

mkdir apps/polls

Next, run startapp to create "polls" in under the "app" project directory.

startapp polls apps/polls

Install the app;

INSTALLED_APPS = [
'apps.polls'
]

migrate:

makemigrations polls
migrate

optional:
main urls.py

urlpatterns = [
path('polls/',include('apps.polls.urls'),
]

See Also

django migrate

Cuauhtemoc over 2 years ago
This website uses short-lived cookies to improve usability.
Accept or learn more