How to create a Django program

Source: Internet
Author: User
Create a Django Program

Terminal command: Django-admin startproject sitename

When the IDE creates a Django program, it is essentially automating the above command

The above SiteName is the name of the project you define!

Other common commands:

Python manage.py runserver 0.0.0.0:port python manage.py startapp appname python manage.py syncdb python manage.py make Migrations python manage.py migrate python manage.py createsuperuser

settings.py Placement Profile

urls.py Storage Routing System (map)

wsgi.py let you do configuration: Wsgi has a multiple of a uwsgi and WSGI, you use that kind of wsgi to run Django, generally do not have to change only when you use

Manage.py is the Django startup hypervisor.

Above configuration file, if it is a beginner do not modify after the creation of project, because it involves a lot of configuration files need to be modified

Project and App Concepts

We are currently creating a project,project below can have a lot of apps, what is the principle of it!

The project we created is a big project, and there are a lot of features: (a project has multiple apps, in fact he's a sort of big project for You)

"Project    --web (foreground function)    --administrator (background management function) a project has multiple apps, but he's a sort of" ' "for your big project.      

Create an App

Python manage.py Startapp App01

If you are creating an app, we can understand that the app is completely independent of the app in the phone, and the benefit is to reduce the coupling between them, and not to let them build relationships!

The admin inside the app is the platform that provides the background management, test is used for testing!

Admin Background Management:

Synchronizing databases

Python manage.py syncdb #注意: Django 1.7.1 and above need to use the following command Python manage.py makemigrationspython manage.py Migrate

Create Super User

Python manage.py Createsuperuser

Enter the username and password you want to set, then start Django and enter Rul/admin: http://127.0.0.1:8000/admin/

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.