1π
The duplicate sign/
appeared because you define two URLs that maps the sign_up_in
view.
The first one is on the project level urls.py
:
urlpatterns = [
...
path('sign/', include("main.urls")),
]
This pattern will also "include" the urls from your app urls.py
.
urlpatterns = [
...
path("sign/", views.sign_up_in, name = "sign_up_in")
]
So, whenever you call the sign_up_in
URL in the template the URL will show the full path based on how you defined your URL pattern. In your case it is
sign/ <-- from your project urls.py
sign/ <--- from your app urls.py
# output:
sign/sign/
In order for this to work properly, you need to remove the path('sign/', include("main.urls"))
.
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('/', include("main.urls")),
]
So whenever you have to define a new URL in your main
app urls.py
, do not repeat it in your project-level URLs to avoid unwanted results.
NOTE: Your
main.urls
will always start on leading/
so it is wise to
omit any leading/
in yourmain
appurls.py
whenever you define new
URLs.
0π
In your app urls.py change
path("sign/", views.sign_up_in, name = "sign_up_in")
to
path("", views.sign_up_in, name = "sign_up_in")
You alreday defined "sign/" in your main urls.py so every url from this app will start with sign/*
- [Answered ]-404 error while trying to post using django tasty pie
- [Answered ]-Use managers in Factory-Boy for models
- [Answered ]-Show Integer choice value as Characters (not integer) in Admin
0π
urlpatterns = [
path('admin/', admin.site.urls),
path('', include("main.urls")),
path('sign/', include("main.urls")), #remove this
]
You already included main.urls
once
- [Answered ]-Cannot decode/encode in UTF-8
- [Answered ]-Convert Queryset to dictionary with values for JSON
- [Answered ]-Django filter from date to date