Ways to install Django and create projects using Python

Source: Internet
Author: User
Tags install django
This article describes how to install Django using Python and how to create a project

The example described below is performed under python2.7 and the python3.x operation is the same (and can be omitted from the environment configuration)

View PIP version

install Django, "1.10.3" is the Django version number

After the installation is successful, you will see the Django_admin.exe file in the directory

View the Django version

Configuring Environment variables

Add the Python path and the Django path to the system environment variable separately

    • D:\Python27

    • D:\Python27\Lib\site-packages\django\bin

    • D:\Python27\Scripts

Enter the "django-admin" command at the Windows command prompt to display the commands provided by Django

Create a new folder and start creating the project with the Startproject command, NSDS I get the project name casually

After creating, open the NSDS, below a brief introduction to the table of contents (refer to the Novice tutorial)

|--nsds| |--init.py| |--settings.py| |--urls.py| |--wsgi.py--manage.py

    • manage.py A useful command-line tool that allows you to interact with the Django project in a variety of ways.

    • nsds/init.py An empty file that tells Python that the directory is a python package.

    • nsds/settings.py The setup/configuration of the Django project.

    • nsds/urls.py The URL declaration of the Django project; A "directory" of Django-driven Web sites.

    • nsds/wsgi.py a WSGI-compatible WEB server's portal to run your project.

View the commands provided by manage

Start service: Using the Runserver command, the default address is "127.0.0.1:8000"

You can also specify an address

Python manage.py runserver 127.0.0.1:8001

If the startup succeeds, enter the address in the browser as shown in:

Enter "127.0.0.1:8000/admin" (admin is a backend management system that Django comes with.) )

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.