Because the server uses the third party to provide, they only installed the python2.7 on the server, therefore this study Note's Django uses the 1.5.8
1.python Installation: Please search by yourself
2. Install Django:
Website Download django1.5.8 decompression, in the cmd command mode into the Django directory, enter the following content:
Python setup.py Install
3. Inspection and Installation:
In cmd command mode: Into the python environment: python
>>>import Django
>>>
If there is no error, the Django installation is successful;
4. Configure Environment variables:
C:\Python27; C:\Python27\Lib\site-packages\django; C:\Python27\Scripts
Make sure that the three paths above correspond to the path of your machine are added to the path variable, as shown in figure:
5. Create Project:
Enter the directory where you want to create the project, and enter the following command:
d:\work\workspace_python>django-admin.py Startproject Sidland
5.1 Open django-admin.py file directly if present; Please modify the open access to the file ending with. py as: Python.exe
5.2 If "usage:django-admin.py subcommand [options] [args]" prompts; Please enter the following command:
D:\work\workspace_python>python C:\Python27\Scripts\django-admin.py Startproject Sidland
Specifies the full path of the django-admin.py;
Once created, you can see the following directory structure:
Description of project creation success;
6. Modify the setting.py in Sidland to modify the following:
Time_zone = ' Asia/shanghai '
Language_code = ' ZH-CN '
Installed_apps = (
' Django.contrib.auth ',
' Django.contrib.contenttypes ',
' Django.contrib.sessions ',
' Django.contrib.sites ',
' Django.contrib.messages ',
' Django.contrib.staticfiles ',
' Reading ', #增加阅读模块
# Uncomment the next line to enable the admin:
# ' Django.contrib.admin ',
# Uncomment the next line to enable admin documentation:
# ' Django.contrib.admindocs ',
)
7. Modify the urls.py in Sidland and add the following in patterns:
URL (r ' ^reading/index ', ' Reading.views.index '),
8. Create Reading applications:
Enter project folder: CD Sidland
Create application: Python C:\Python27\Scripts\django-admin.py startapp Reading
9. Enter the application reading directory, modify the views.py, add the following code:
From django.http import HttpResponse
def index (req): Return
httpresponse (' Hello world! ')
10. Start Application:
D:\work\workspace_python\sidland\reading>python manage.py Runserver
Next, use the browser to access your app. Default port: 8000
=========================================== Gorgeous split Line ========================================
The above is manually created, because CMD doc operation is not very convenient, and add my Java background, accustomed to eclipse, so the following way to create the project is to use the Eclipse+python plug-in to create;
1. Download eclipse:http://www.eclipse.org/downloads/
2. Download Python plugin: PyDev
Move all files under the plugins directory to the corresponding directory in Eclipse, move all files under the feature directory to the corresponding directory in Eclipse, and finally launch Eclipse, Software upates-in help-"Manage" Configuration and then pops up the interface to see the Pydev plugin.
Before installing PyDev, make sure that you have installed Java 1.4 or later, Eclipse, and Python. Next, start installing the PyDev plugin. Start Eclipse and install PyDev with Eclipse Update Manager. Locate the Help bar in the Eclipse menu bar and select Help > Software Updates > Find and Install. Select Search for new features for install, and then click Next. In the displayed window, select New remote site. A dialog box pops up asking for the name and link of the new update site. Here, the name entry PyDev, of course, you can also enter a different name, the link input http://pydev.org/updates. Then, click Ok.
3. Configure the Python path:
After installing the PyDev, you need to configure the Python/jython interpreter, which is simple to configure.
In the Eclipse menu bar, select Window > Preferences > Pydev > Interpreter-(Python/jython), where you configure the Python/jython interpreter, following the Python Provides an example of how to configure.
First, create a project
If this is the first time you use Django, then you have to make some initial settings. That is, by automatically generating code to create a Django project-a setup set of Django projects that includes database configuration, Django detail Options settings, and application feature configurations, as shown in the following steps.
1. New Django Project
2. Create Web site module app
3. Test the new module is normal
Validating models
... Errors found
March, 2014-10:26:53
Django version 1.6.2, using Settings ' mysite.settings ' starting
Develo Pment Server at Http://127.0.0.1:8000/
Quit the server with Ctrl-break.
When the server starts up, go to the browser to enter the URL: http://127.0.0.1:8000, you will see a delightful, soft, pale blue "Welcome to Django" page. Indicates that it is working correctly.