Aug 19, 2024
pip install Django==2.0.7
for consistency.source bin/activate
scripts/activate
django-admin startproject <project_name>
to create a new Django project.python manage.py runserver
.settings.py
BASE_DIR
: Path to the project directory.SECRET_KEY
: Unique key for security, should not be exposed in production.DEBUG
: Set to True
for development, change to False
in production.INSTALLED_APPS
: List of Django applications used in the project.MIDDLEWARE
: Framework for handling requests and responses.DATABASES
: Configuration for the database used.STATIC_URL
: URL for serving static files.python manage.py startapp <app_name>
to create a new app.python manage.py createsuperuser
to access the admin interface.models.py
to represent database tables.makemigrations
and migrate
to apply changes to the database.forms.py
for user input.ListView
, DetailView
, CreateView
, UpdateView
, and DeleteView
for common patterns.get_context_data
and get_object
for customization.urls.py
for routing requests to views.