In the series of Django tutorial, this is the second lecture, in which we will command to create an application and will also understand the file structure of the application.
Please click the below link for Django tutorial1.
Django Tutorial 1 — Project File structure
I am starting a new Course on Django Web Framework. Today we are going to see File structure of Django Project.
So, in the last tutorial, we created a project Folder named “FirstProject”.
Go to that directory
Now, In this directory, we type the following command which will create an application
python3 manage.py startapp your_project_name
For your clarification, I pasted ss from my project. Here, the application name is Firstapp.
Let’s discuss files.
- admin.py: Django comes with a built-in admin interface.
- apps.py: This file helps configure the application. You can include application configuration in this file.
- models.py: This file creates a database for the web application.
- tests.py: You can write tests here, to check whether the application is working as expected.
- views.py: A view function or Python function which takes a request and returns a response is written in this file.
- __init__py: This file let the Django/Python to treat the directory as a python package.
- migrations: A migration folder stores “migrations” files that will automatically update your database as you modify a model.