Open Terminal Input Command
django-admin startproject demo #其中demo是项目名称可以自定义
Open the Terminal input command in the manage.py peer directory to start the project
python3 manage.py runserver
Enter the native IP in the browser 127.0.0.1:8000 Linux system command line input ifconfig can view IP
Show it worked! indicates a successful run
Create an App
python3 manage.py startapp myweb #myweb是应用名称u
Configure root route, sub-route, and views view
Open the URLs in the demo directory to configure the root route enter the following code to overwrite
from Import Url,include from Import = [ url (r'^', include ('mydemo.urls ' )),]
Create a sub-route under Mydemo
from Import URL from Import = [ url (r'^hello', Views.index),]
Open the Views view overlay code under Mydemo
from Import Render from Import HttpResponse # Create your views here. # Define view functions, business logic def Index (Request): # return a sentence return HttpResponse ('Hello world!!! ')
Restart Project Python3 manage.py runserver
Access native Ip127.0.0.1/hello in the browser #子路由可以设置路径
Linux system constructs Django framework for Web Access