In Django, a project can consist of multiple apps, each of which handles a specific aspect of the project’s functionality. Apps are modular, allowing you to organize your project into reusable components.
INSTALLED_APPSDjango provides the startapp command to generate the default app structure with essential files like models, views, and admin configuration.
# Create a new app called 'myapp'
python manage.py startapp myapp
# Default files created inside the app
myapp/
__init__.py
admin.py
apps.py
models.py
tests.py
views.py
# Register app inside INSTALLED_APPS
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
]
# Start Django development server
python manage.py runserver
Project ➜ App ➜ Models ➜ Views ➜ URLs ➜ Browser
See how views.py interacts with the browser. Change the text below: