Every Course in $5, Hurry Up!

Full Guide | Django Project Directory Structure Explanation

Django project directory structure copy
Django Django Tutorials

Full Guide | Django Project Directory Structure Explanation

Django Project Directory Structure and All files Explanation

In this Django tutorial, we will learn Django Project Directory Structure and related information about that files with examples because understanding its structure and purpose of files will lead you in the best way to clear the Django framework concept. You know Django is the web framework, that is mostly used nowadays, So, very important to learn this framework from a basic level if you want to become a good web developer or web application developer.

Therefore, when we create a Django project, we get a number of files and folders. But you don’t know, which file has which mean. So we will learn that which file what do in the Django project. Each file will be discussed in this Django tutorial for beginners with examples.

To learn Django project directory files and their structure, you should know, how to install Django properly in your system. The linked page about the installation of Django has a detailed discussion, that will help you to start Django.

Django Project Directory Structure

Using the below command you can create a Django project, after running this command, the system creates some default files for your new project. That files we will discuss here to understand their functionality and roles in the Django project

django-admin startproject webhouse

  •  __init__.py
  • settings.py
  •  urls.py
  • wsgi.py

After processing the command you run, you will get a number of files in a folder. Above files, you will find a folder with that name as you give at the time of creating a project. So, in the following discussion, we will provide and explain these files. So, understand the purpose of default files and their role in Django.

Django project default files explanation

__init__.py :

This shows that this is a python empty file which shows that all these files are part of a package of your Django project name. If you want to create a python package then you have to create a __init__.py file because it tells the interpreter, this is the python package.

settings.py:

This is a very important file in this package because it contains all the settings of your Django project for example adding your application reference, session, cache and cookies settings, time, etc. If you make any error in this file then your project will not and give errors.

 urls.py:

This file has its own importance in the Django project because here, you make a path for your different web pages. If you have created an application in the Django project, then you give a path reference of that application in this file.

wsgi.py:

It stands for  Web Server Gateway Interface. it is the calling convention between server to web application when web application user requests to the server. it is written python programming and its latest version is 1.0.1

asgi.py:

It stands for Asynchronous Server Gateway Interface. And Django also supports ASGI, when we start a Django project, then this file is created by default and its required settings also created for you. We did not need to modify such a file.

If you want to learn more about Django project structure and its more information then follow its documentation 

The above files were in the project named folder but two files are outside of that folder, which we have to discuss here.

manage.py:

This file is very important, using this file you can do many works on your Django project e.g to the running project, creating or changing the database, etc.

Example:

if you want to run your Django project then you have to write a command like this one:

python manage.py runserver 

db.sqlit3:

db.sqlit3 is the database default file, you will find such file in the root folder. Because every Django project must need a database in which some basic and default information needs to be store. So this is by default created when you run a command for runserver a project.

Conclusion

Thank you to give time to read our tutorial, Sure you will have learned today’s topic about the Django project directory sturcurre. Anyhow, if you have any kind of confusion or issues you can discuss them with us. We always appreciate that students or readers who have some ability to learn or to solve problems if they face them. We also want to help our readers / studetns.

Share this Django tutorial with your social media friends on Facebook, Twitter, LinkedIn

Leave your thought here

Your email address will not be published. Required fields are marked *

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
  • Attributes
  • Custom attributes
  • Custom fields
Click outside to hide the comparison bar
Compare