Enter the Python environment and enter:
1 >>> pip install Django
Wait for the installation to complete before you can use Django.
Version used in this article: Python 2.7.9,django 1.8.0
Build the project:
In command mode, enter:
A project named MySite is created in the current directory.
Django comes with a development server dedicated to testing. is still in the command environment, enter MySite, enter:
> Python manage.py runserver
Now enter the address in the browser: 127.0.0.1:8000 to the test page.
To add an app:
Under \mysite, enter:
> Python manage.py startapp Hello
An app called Hello will be created. But you need a little bit of setup to use it.
First enter \mysite\mysite, in the settings.py in the Installed_app add:
' Hello ',
Add a mapping in urls.py:
URL (r'^hello/$'hello.views.index'Index '),
Enter \mysite\hello, add in views.py:
from Import HttpResponse def Index (req): return HttpResponse ('')
When you are finished, you can open your browser and see the results at 127.0.0.1:8000/hello
Python + Django Note 1 *