Django Getting started with Django Django Concepts


django-admin is a command line tool that ships with Django. It comes with several useful commands for getting started with and managing a Django project. The command is the same as ./ , with the difference that you don't need to be in the project directory. The DJANGO_SETTINGS_MODULE environment variable needs to be set.

A Django project is a Python codebase that contains a Django settings file. A project can be created by the Django admin through the command django-admin startproject NAME. The project typically has a file called at the top level and a root URL file called is a project specific version of django-admin, and lets you run management commands on that project. For example, to run your project locally, use python runserver. A project is made up of Django apps.

A Django app is a Python package that contains a models file ( by default) and other files such as app-specific urls and views. An app can be created through the command django-admin startapp NAME (this command should be run from inside your project directory). For an app to be part of a project, it must be included in the INSTALLED_APPS list in If you used the standard configuration, Django comes with several apps of it's own apps preinstalled which will handle things like authentication for you. Apps can be used in multiple Django projects.

The Django ORM collects all of the database models defined in and creates database tables based on those model classes. To do this, first, setup your database by modifying the DATABASES setting in Then, once you have defined your database models, run python makemigrations followed by python migrate to create or update your database's schema based on your models.