Teach you to install Python Django (text) _python

Source: Internet
Author: User
Tags install django

Installation environment: Python version 2.7.5, win7 system
Install 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 to the Django-1.5.5 directory just after extracting the Python setup.py install, as shown in the following figure:


Description: The Django installation command actually replicates Django to the local Python installation directory D:\Python27\Lib\site-packages.
Test 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 a project, such as: E:\workspace\pythonworkspace).
2,django-admin.py startproject mydjangosite (mydjangosite for your project name)
Special Note: 1. The D:\Python27\Lib\site-packages\django\bin must be added to the value environment variable under path before executing the command.
The default open program for the 2.python folder is Python.exe. Otherwise, the django-admin.py file will appear after the execution of the program. (It took me a long time to find that I used vim to open the Python file by default, resulting in the creation of a project command that does not generate a file directory under that directory)
3, Document Description:
manage.py: A command-line tool that allows you to interact with the Django project in a variety of ways. Type Python manage.py help to see what it can do. You should not need to edit this file; it is pure for convenience to build it in this directory. __init__.py: Let Python consider the directory as a 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: Setup or configuration of the Django project. View and understand the settings types and their default values available in this file. Urls.py:Django the URL setting for the project. Visualize it as a directory for your Django site. At present, it is empty.
Wsgi.py:An Entry-point for wsgi-compatible webservers to serve your project. Deploy with WSGI for more details.
Refer to documentation for specific use HTTPS://DOCS.DJANGOPROJECT.COM/EN/1.4/INTRO/TUTORIAL01/
Running the development Server test
The Django Development Service is available during development, a built-in, lightweight Web service. We provide this server to allow you to quickly develop your site, which means that you do not need to configure the product-level WEB server (such as Apache) until you are ready to release the 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 the Python manage.py runserver, as shown in the following figure:


Browser http://127.0.0.1:8000 test



To this for the test success. 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.