Skip to main content

Project Structure



Above Diagram shows us Django project default structure.
Let us understand this structure
So if we see the topmost level contains following this db.sqlite3, demoProject directory, manage.py. Let see what these are for:-

  1. Db.sqlite3:- this is the database file which is created by django. By default django creates project’s database using sqlite. This db file will be holding all the data which our project produces we can change database, we will see that in further tutorials.
  2. demoProject :- This the default directory which is created by django. This directory keeps all the configurations of the project like settings.py, wsgi.py, urls.py. We will talk about these after we we finish this level.
  3. Manage.py :- this is the management file which has lots of uses like it is used to run project, it is used to run management commands, its used for running django shell and many more important things.

Now let's explore demoProject configuration which we discussed in point number 2 above.

This directory contains following files settings.py, wsgi.py, urls.py. Lets learn about these:-
  1. setting.py :- This files is the most important file of django application it contains all these settings of the projects like middle-wares, database settings, allowed_hosts, app declarations, smtp settings etc. Basically it all configurations are written here related to project
  2. urls.py :- this is the main urls manager file whenever any request comes first routing is done there suppose request comes like www.yourdomain.com/users/phones. Now in these url we are fetching phones of user this is understood by django in this file. We will talk in detail when we will create endpoint.
  3. wsgi.py :- this file is used when we deploy our django application on server.

Comments