login.html内容如下:
{% load static %}
Login
{% csrf_token %}
平台
urlpatterns = [
url(‘admin/’, admin.site.urls),
url(‘index/’, bv.index),
url(‘platform/’, bv.index_platform, name=‘index_platform’),
url(‘fenxi/’, bv.index_fenxi, name=‘index_fenxi’)
]
app下的urls.py内容如下:
from django.conf.urls import url, include
urlpatterns = [
url(r’^index’, views.index),
url(r’^platform’, views.index_platform, name=‘index_platform’),
url(r’^fenxi’, views.index_fenxi, name=‘index_fenxi’)
]
views.py内容如下:
from django.shortcuts import render
from django.shortcuts import redirect
def index(request):
return render(request, ‘login.html’)
if request.method == “POST”:
user = request.POST.get(‘user’, None)
pwd = request.POST.get(‘pwd’, None)
if user == ‘root’ and pwd == ‘12