Home > Backend Development > Python Tutorial > How to install django and create a project using python

How to install django and create a project using python

高洛峰
Release: 2017-03-14 15:23:25
Original
1832 people have browsed it

This article introduces how to use python to install django and create a project

The examples introduced below It is performed under python2.7. The operation of python3. Install django

, "1.10.3" is the version number of django

How to install django and create a project using python##After successful installation, you will see the django_admin.exe file in the directory as shown below

View django versionHow to install django and create a project using python

How to install django and create a project using python##Configure environment

Variables

Add the python path and django path to the system environment variables respectively

How to install django and create a project using python

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

    D:\Python27\Scripts
  • Enter "django" at the windows command prompt -Admin" command and press Enter to display the commands provided by django
  • Create a new folder, then start creating the project, use the startproject command, NsDs is the project name I randomly obtained

After creation, open NsDs. Here is a brief introduction to the directory (refer to the novice tutorial)

How to install django and create a project using python

|-- NsDs| |-- init.py| |-- settings.py| |-- urls.py| |-- wsgi.py-- manage.py
Copy after login

How to install django and create a project using python

manage.py

A practical command line tool that allows you to interact with the Django project in various ways.

NsDs/

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

    settings.py
  • Settings/configuration of the Django project.
  • NsDs/

    urls.py
  • The URL declaration for this Django project; a "directory" of websites powered by Django
  • .

  • NsDs/
  • wsgi.py

    Portal to a WSGI-compatible web server to run your project. Check the commands provided by manage

  • #Start the service: use the runserver command, the default address is "127.0.0.1:8000 "

You can also specify the address

How to install django and create a project using python

python manage.py runserver 127.0.0.1:8001
Copy after login

If the startup is successful, enter the address in the browser, As shown in the figure below:

How to install django and create a project using python

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

 How to install django and create a project using python

 

The above is the detailed content of How to install django and create a project using python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template