"Python Efficient Development Combat" practical walkthrough-building an Application 2

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.