*project- New.app-app want to add an app inside app
1.how to register this to the setting.py file?
- what are the things I should be worried once I have an app with in an app?
Advertisement
Answer
First create inner app using command
django-admin startapp demoapp
Here i created Two apps first at Project Directory & second one is in app directory
├───demo │ └───__pycache__ ├───myapp <-------- this is primary app │ ├───demoapp <-------- this inner app │ │ ├───migrations │ │ │ └───__pycache__ │ │ ├───templates │ │ └───__pycache__ │ ├───migrations │ │ └───__pycache__ │ ├───templates │ └───__pycache__ └───static
Now do settings in settins.py
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'myapp', <-------- this is primary app 'myapp.demoapp', <-------- this inner app ]
Now do settings in (demoapp > apps.py)
from django.apps import AppConfig class DemoappConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'myapp.demoapp'