"Python Efficient Development Combat" practical walkthrough--Developing a Django Site 1

Source: Internet
Author: User

6.2 Practical Walkthrough: Developing a Django Site

Developing a Web site with Django follows a Django set of development processes. This section demonstrates the Django development process and related technologies by creating a message entry page.

6.12.1 Building a Project

Before Django development, you need to build a Django project with Django-admin, with the following syntax:

#django-adminstartproject Site Name

where Django-admin is the Django Project management tool that is generated in the Python directory after the Django component is installed. For example, create a development project called Djangosite:

#django-admin Startproject Djangosite

The command creates a subdirectory djangosite in the current directory, where the Django-developed default file is generated, and the contents of the Djangosite directory are as follows:

djangosite/   manage.py    djangosite/       __init__.py       settings.py        urls.py       wsgi.py
 Several of the files generated by default are important and will be used or maintained in future development, explaining their meanings as follows:

    • manage.py: This is the command-line tool that Django uses to manage this project, and then the site is run, the database is automatically generated, and the static file collection is done through the file.
    • The Inner djangosite/directory contains the actual file for this project, and because it contains the __init__.py file, the directory is also a Python package.
    • djangosite/__init__.py: Tell Python that the directory is a Python package with no content.
    • Djangosite/settings.py:django the project configuration file. By default, it defines the Django component referenced by this project, the Django project name, and so on. In the subsequent development, you will also need to configure the database parameters, import other Python packages, and other information.
    • djangosite/urls.py: Maintains the URL route map for the project, which defines which Python module interprets and provides feedback on the URL of the client access. By default, only the "/admin" is defined as the interpreter for the Administrator site.
    • djangosite/wsgi.py: Defines WSGI interface information for integration with other Web servers, typically this file is not changed after it is generated.

A friend who likes this book can learn this picture oh.

"Python Efficient Development Combat" practical walkthrough--Developing a Django Site 1

Related Article

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.