Use of the Django Development server

Source: Internet
Author: User

Let's verify that your Django project is working. If you do not have an external mysite directory, go to this directory and run the following command:

$ python manage.py runserver

You will see the following output on the command line:

Performing system checks ... 0 Errors Foundmay, 2015-15:50:53django version 1.8, using Settings ' mysite.settings ' starting development Server at HT Tp://127.0.0.1:8000/quit the server with Control-c.

This indicates that you have started the Django Development server, a lightweight Web server written in pure python. We built it in Django so you can quickly develop a product without configuring a server for the production environment-for example, apache---until you're ready to make a production environment.

now is a good time to explain this: do not use this server in any environment that is similar to a production environment. It's just for use in development. (our focus is to write a web framework, not a Web server.) )

now that the server is running, please use your browser to access http://127.0.0.1:8000/. you will see a "Welcome to Django" page in the light blue background. It's running!

Change port

By default, therunserver command starts the development server on port 8000 of the internal IP.

If you want to change the port of the server, pass the port you want to use as a command-line parameter to it. For example, this command starts the server on port 8080:

$ python manage.py runserver 8080

If you want to change the IP address of the server, put the IP address and port number together. So to listen to all the extranet IPs, use (useful if you want to show your work on another computer):

$ python manage.py runserver 0.0.0.0:8000

All documentation for the development server can be found in the runserver reference Manual.

Automatic overloading of runserver

The development server automatically re-loads Python code as needed.  You do not have to restart the server in order for the changed code to take effect. However, some behaviors, such as adding files, do not trigger a restart of the server, so in this case you will need to restart the server manually.

Use of the Django Development server

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.