Django Django Command (manager.py)

Source: Internet
Author: User
Tags server port

django-admin.py startproject MySite

This command creates a MySite directory in the current directory.

django-admin.py this file in the C:\Python27\Lib\site-packages\django\bin folder, you can add the directory to the system path.

Django has a lightweight Web server built into it.

Enter the MySite directory, now go in there and run the python manage.py runserver command

Start the server, use Http://127.0.0.1:8000/to browse, 8000 is the default port number.


python manage.py runserver 8080

Change server port number


python manage.py Shell

Start the Interactive interface


python manage.py startapp Books

Create an app called books


python manage.py Validate

Verify that the Django Data model code has errors


python manage.py sqlall Books

Generate SQL code for the model


python manage.py syncdb

Run the SQL statement and create the corresponding table for the model


python manage.py Dbshell

command line tools to start the database


manage.py sqlall Books

View all the tables under this app


python manage.py syncdb

Synchronize the database to generate additional database tables used by the Admin 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.