Teach you to install Python Django

Source: Internet
Author: User
Installation environment: Python version 2.7.5, win7 system
Installing Django
https://www.djangoproject.com/download/Official Download django-1.5.5.tar.gz
1, after decompression (my directory is D:\myapp\Django-1.5.5)
The 2,dos command executes the command Python setup.py install in the Django-1.5.5 directory just after decompression, as shown in the following:

Description: The Django installation command is actually copying Django to the local Python installation directory D:\Python27\Lib\site-packages.
Test your Django Installation
# Vim:set Fileencoding=utf-8: #测试Django安装import djangoprint Django. VERSION

The output is successful as follows:

Start a project
The 1,dos command goes to a directory (where you want to create the project, such as: E:\workspace\pythonworkspace).
2,django-admin.py startproject mydjangosite (mydjangosite for your project name)
Special Note: 1. You must add the D:\Python27\Lib\site-packages\django\bin value environment variable under path before executing the command.
The default open program for 2.python folders is Python.exe. Otherwise, the django-admin.py file is opened when the program finishes executing. (This problem for a long time to find that I use the VIM default open Python file, resulting in the completion of the creation of the project command is not in the directory generated file directory)
3, File Description:
manage.py: A command-line tool that allows you to interact with the Django project in a number of ways. Type Python manage.py help and see what it can do. You should not need to edit this file; it is purely for convenience to generate it in this directory. __init__.py: Let Python treat the directory as a required file for a development package (that is, a set of modules). This is an empty file, generally you do not need to modify it. settings.py: The setup or configuration of the Django project. View and understand the types of settings available in this file and their default values. The URL setting for the Urls.py:Django project. Visualize it as the directory for your Django site. Currently, it is empty.
Wsgi.py:An Entry-point for wsgi-compatible webservers to serve your project. See how to deploy with WSGI for more details.
Refer to document HTTPS://DOCS.DJANGOPROJECT.COM/EN/1.4/INTRO/TUTORIAL01/for specific usage methods
Run the dev server test
The Django Development Service is available during development, a built-in, lightweight Web service. We provide this server to allow you to develop your site quickly, meaning that there is no need to configure a product-level WEB server (such as Apache) before you are ready to release your product. The development server monitors your code and loads it automatically, so you can easily modify the code without restarting the service.
DOS commands go to the project you just created to execute Python manage.py runserver, such as:

Browser http://127.0.0.1:8000 test

To this for the test to succeed. Here the Python Django Web development environment is basic.

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.