DEV Community

Cover image for Django Files Explained
Chris Achinga
Chris Achinga

Posted on • Updated on

Django Files Explained

A skeleton of a django project looks:
(Based on our django Django-Starter Template)

This is just a summary of the documentation on and a continuation of our "Getting Started with Django" article.

├── myapp
│   ├──
│   ├──
│   ├──
│   ├── migrations
│   │   └──
│   ├──
│   ├──
│   └──
└── _projectroot
    ├── __pycache__
    │   ├── __init__.cpython-38.pyc
    │   ├── settings.cpython-38.pyc
    │   ├── urls.cpython-38.pyc
    │   └── wsgi.cpython-38.pyc
Enter fullscreen mode Exit fullscreen mode

These project files are:

  1. The outer _projectroot/ root directory is a container for your project. The folder can be renamed.

  2. A command-line utility that lets you interact with this Django project in various ways. Do not touch this file.

  3. The inner _projectroot/ directory is the actual Python package for your project. Its name is the Python package name you’ll need to use to import anything inside it (e.g. _projectroot.urls).

  4. _projectroot/ An empty file that tells Python that this directory should be considered a Python package.

  5. _projectroot/ Settings/configuration for this Django project.

  6. _projectroot/ The URL declarations for this Django project; a “table of contents” of your Django-powered site.

  7. _projectroot/ An entry-point for ASGI-compatible web servers to serve your project.

  8. _projectroot/ An entry-point for WSGI-compatible web servers to serve your project.

The App files

  1. Registering your models here for them to be manipulated on the django admin

  2. Contains the app configuration code

  3. Define your models here. These are the tables used for storing data and defining their relations

  4. Writing tests for the app

  5. views: Defining data to be rendered on the templates

Discussion (0)