This post was reproduced from: http://blog.csdn.net/wklken/article/details/7234157
The first Django program:
1. Install the python2.x, it is recommended to install 2.6 or 2.7 www.Python.org
Configure environment variables, properties--environment variables--System variables
Add Python_home C:\Python27
Modify path Join%python_home%
2. Installing the Django https://www.djangoproject.com/
Currently 1.3.1, unzip the downloaded files and place them where you want them.
Start-run-cmd switch to the location where the extracted files are placed
Execution: setup.py Install
Add%python_home%\scripts to path after installation, because the django-admin.py below the path will be used after
3. New project:
Start-run-cmd switch to work space
Build Project
django-admin.py Startproject Hello
Get a Hello folder under four files
__init__.py says this is a Python package with no content
Manage.py provides a simplified django-admin.py command
settings.py configuration file
urls.py URL Mapping file
The service can now be started
manage.py Runserver
Access to: Http://localhost:8000/
The page is as follows:
4. Edit the project with Pydev to achieve the first HelloWorld
After the Pydev plugin is installed and configured, turn on eclipse
File–new–pydev Project
Enter project name
Cancel the use Default and choose the directory you created for the third step.
Add Source code folder:
Click on Project, right button, properties
Pydev-pythonpath Source floders tab ADD Source Floder
Join the current project folder
Create a first.py file under SRC
The contents are as follows
Fromdjango.http Importhttpresponse
defHello(Request):
Returnhttpresponse ("Hello world! First Django")
Modify urls.py, add
(R' ^first$ ', ' First.hello '),
Select manage.py-Right-–run as–run configurations
Join run parameter (x) = Arguments tab
Runserver–noreload
After that, you can start the service directly in eclipse
Select manage.py, right-click Python Run
Access:
Http://localhost:8000/first
Django Note--eclipse+pydev First Django example HelloWorld