[Django] Django command (Manager. py)

Source: Internet
Author: User

Django-admin.py startproject mysite 

This command creates a mysite directory in the current directory.

Django-admin.py file in c: \ python27 \ Lib \ Site-packages \ Django \ bin folder, you can add this directory to the system path.

Django has a built-in lightweight Web server.

If you enter the mysite directory, enter the Directory and runPython manage. py runserverCommand

Start the server and Use http: // 127.0.0.1: 8000/to browse the server. 8000 is the default port number.

 

Python manage. py runserver 8080

Change server port number

 

Python manage. py Shell

Start interaction interface

 

Python manage. py Startapp books

Create an app named books

 

Python manage. py validate

Verify that the Django Data Model Code is incorrect.

 

Python manage. py sqlall books

Generate SQL code for the model

 

Python manage. py syncdb

Run the SQL statement to create the corresponding table of the model.

 

Python manage. py dbshell

Command line tool for starting a database

 

Manage. py sqlall books

View all tables in the books app

 

Python manage. py syncdb

Synchronize databases and generate additional database tables used on the Management Interface

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.