Django版本(2.0.7)urlpatterns语法

时间:2019-02-03 23:38:14

标签: django django-urls

from django.contrib import admin
from django.urls import path
from . import views

urlpatterns = [
   path('admin/', admin.site.urls),

    path('signIn', views.signIn, name='signin'),
    path('postsign', views.postsign, name='postsignin'),

这是我的urls.py

from django.shortcuts import render 
import pyrebase

config = {
    'apiKey': "API-KEY",
    'authDomain': "cpanel-99cff.firebaseapp.com",
    'databaseURL': "https://cpanel-99cff.firebaseio.com",
    'projectId': "PROJECT-ID",
    'storageBucket': "cpanel-99cff.appspot.com",
    'messagingSenderId': "SENDER-ID"
  }

firebase = pyrebase.initialize_app(config)
auth = firebase.auth()

def signIn(request):
    return render(request,"signIn.html")
def postsign(request):

    return render(request,"welcom.html")

这是我的观点。py

但是每当我在终端上给出命令“ python3 manage.py runserver”时,都会出现以下错误 Page not found at/signin

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>signIN</title>
	</head>
	<body>

		<form action="/postsign/" method="post">
		    {% csrf_token %} 
			Email:
			<input type="email" name="email">
			Password:
			<input type="password" name="password">
			<input type="submit" value="SignIn" >
		</form>
	</body>
</html>

这是我的templateIn文件夹中的signIn.html

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>welcome</title>
	</head>
	<body>
	{% csrf_token %} 
	Welcome
		

	</body>
</html>

这是我的welcome.html,它也位于模板文件夹中。

0 个答案:

没有答案