Django 常用命令
建立应用
python manage.py startapp stu
设置中添加应用
1 INSTALLED_APPS = [ 2 'django.contrib.admin', 3 'django.contrib.auth', 4 'django.contrib.contenttypes', 5 'django.contrib.sessions', 6 'django.contrib.messages', 7 'django.contrib.staticfiles', 8 "stu", 9 ]
设置子路由
urlpatterns = [ path('admin/', admin.site.urls), url(r"^student/",include("stu.urls")) ]
子路由设计指向
from django.conf.urls import url from . import views urlpatterns= [ url(r"^$", views.login) ]
视图跳转页面