In order to develop a real-world application that conforms to the MVC architecture in your project, you need to build a Django application in your project. Each Django project can contain multiple Django apps. The syntax for creating an application is:
#python Manage.pystartapp App Name
The manage.py is a command-line tool that is generated in the project directory when the project is built, and Startapp is the command keyword, for example:
#cd Djangosite#python manage.py Startapp
After the command is completed, the following directories and file structures are created in the project directory:
app/
__init__.py
admin.py
apps.py
migrations/
__init__.py
models.py
tests.py
views.py
The file features are parsed as follows:
- __init__.py: There is no content, the existence of this file makes the app a python package.
- admin.py: Manages the site model declaration file, which is empty by default.
- apps.py: Application information definition file. A class AppConfig is generated in which to define meta data such as the name of the application.
- Migrations Package: Used to define the reference migration feature later.
- models.py: Adds a file for the model layer data class.
- tests.py: Test the code file.
- views.py: Defines the URL response function.
All of the above files have no actual content when the app was first created and require developers to further write code to complete their functionality.
Interested readers can take a look at the structure of this book, "Python's Efficient development combat"
"Python Efficient Development Combat" practical walkthrough-building an Application 2