#sudo Apt-get Install Python-django
Verify that the installation is successful and that you can import the Django package in Python
#python
>>>import Django
>>>django. VERSION
I'm using a 1.10.7.
>>>quit ()
- STEP2: Creating a Project
>>django-admin Startproject Djangoproject
>>python manage.py Runserver
Default is 127.0.0.1:8000
Open a browser to view Http://127.0.0.1:8000/,it works
- STEP4: Create my app Agenda
>>python manage.py Startapp Agenda
- STEP5: Writing view.py and URLs config for agenda applications
>>CD Agenda;vi views.py
>>CD Agenda;vi urls.py
Knowledge points: The UP arrow ^ and dollar sign $ symbol are very important. The up arrow requires the expression to match the head of the string, the dollar
The symbol requires an expression to match the tail of the string. R represents an original string. So that you can avoid regular expressions
There are too many escape characters.
>>CD Djangoproject/djangoproject; VI urls.py
Note: The URLs here must be in the Djangoproject/djangoproject directory, not the Djangoproject directory, where the wrong directory, input Http://127.0.0.1:8000/agenda, You will get an error. URL matching is not found.
>>python manage.py Runserver
To view Http://127.0.0.1:8000/agenda
- STEP7: In order to make the intranet other machines can be measured, you can set the Sunserver IP for any
>>python manage.py Runserver 0.0.0.0:8090
On other machines, just enter the native IP and 8090 ports to access
If the browser on the other machine does not open the Http://192.168.x.x:8000/agenda, you need to configure the host to allow access
>>CD Djangoproject/djangoproject;vi settings.py
Allowed_host = [' * ']
Note: It is not recommended to set this access host,true only at Debug=false, this is only for testing
Build Django on Linux