Issue
I have a simple Html with CSS which I am trying to render using urls.py and views.py
from django.shortcuts import render
import re
# Create your views here.
# checks valid email
def is_valid_email(email):
# Define the regex pattern for email validation
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
return re.match(pattern, email)
def home(request):
return render(request,'index.html')
def signup(request):
return render(request,'signup.html')
def signin(request):
return render(request, 'signin.html')
and the urls.py being
from django.urls import path
from . import views
urlpatterns = [
path('', views.home),
path('signup/', views.signup),
path('signin/', views.signin),
]
The home is rendering successfully but the signing and signup is not rendering showing the following error
I have urls.py on project level as
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('app.urls'))
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
would appreciate any help!!! My home is rendering perfectly but not the sign in and sign up.
Solution
You don't need ".html" part. Just access "/signin" path.
2) Remove last "/" from app urls.py.
3)
Also templates are usually located in appname/templates/appname
folder, from @Ivan 's comment.
Answered By - Pycm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.