Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Django

Django is a web framework and a Python library for writing backend servers in Python for serving web apps.

A Django project usually contains multiple apps. Note: An app can be included in multiple projects and thus there is generally a many-to-many relationship between projects and apps.

The manage.py Command-Line Tool

manage.py is used as a command-line tool for managing a Django project.

HTTP Request Handling

urlpatterns in an app’s urls.py file maps URL routes to handler functions defined in views.py, each of which takes an HttpRequest, does something, and returns an HttpResponse.

urlpatterns in the project’s urls.py file maps high-level URL routes to the urlpatterns defined for a specific app.

Database Integration

The default database is SQLite, but it is not scalable/production-ready. PostgreSQL, MariaDB, MySQL, and Oracle databases are supported.

A project’s database table schemas and relationships are defined by SQLAlchemy-like models in models.py first, from which python manage.py migrate is used to create the tables or update their schemas.

Django includes an ORM.

Miscellaneous

ASGI- or WSGI-compatible servers (e.g., Apache) should be used for production.