43π
β
You can specify the appβs directory as a second parameter:
python manage.py startapp <app_name> <app_directory>
Note that no directory will be created, the appβs files will be created directly in the specified directory. Example:
python manage.py startapp myapp apps/myapp
Will result in the given directory structure:
apps
βββ myapp
βββ __init__.py
βββ admin.py
βββ apps.py
βββ migrations
βΒ Β βββ __init__.py
βββ models.py
βββ tests.py
βββ views.py
Also note that the command wonβt create the directory for you.
Edit: as another (now deleted) answer pointed out, running the command from the apps
directory would also work:
cd apps
python ../manage.py startapp myapp
π€aumo
4π
You can also use the django-admin
command as well.
cd apps && django-admin startapp app_1
this will work as well
π€Koushik Das
- [Django]-Django: AppRegistryNotReady()
- [Django]-Machine Learning (tensorflow / sklearn) in Django?
- [Django]-Making a Django form class with a dynamic number of fields
Source:stackexchange.com