In this post, we will discuss about Django project’s basic directory structure.

Here is the directory structure:

<project-name>
    <app>
         <migrations>
         __init__.py
         admin.py
         apps.py
         models.py
         tests.py
         views.py
    <project-name>
         __init__.py
         settings.py
         urls.py
         wsgi.py
    <templates>
    manage.py
  • project-name
    This is the root of our web application.
  • app
    This folder organizes all the components of the application.

    • migrations
      This folder contains our migration data that is used to create tables in database.
    • views
      This folder contains all our view files that contains methods corresponding to URLs. In some other technologies, views are called controllers.
    • _init_.py
      The _init_.py files are required to make Python treat the directories as containing packages. Packages are a way of structuring Python’s module namespace by using “dotted module names”
    • models.py
      This file contains all our model classes that represents tables in database.
  • project-name/project-name
    This folder is the Django root of our application.

    • __init__.py
    • settings.py
      This is the core setting file of a Django application.
    • urls.py
      This file maps URL patterns to methods in view files.
    • wsgi.py
      Web Service Gateway Interface is the Python way of deploying web applications. This file defines an entry point for WSGI compatible web servers.
  • templates
    This folder contains our template files that are html files mixed with Django code.
  • manage.py
    This is a command line utility that let us interact with our project.

Creating your first django project