Add redirect for common typo :)
This commit is contained in:
parent
77af72a712
commit
30540cd2f4
|
@ -1,14 +1,27 @@
|
|||
from django.conf.urls.static import static
|
||||
from django.urls import path, include
|
||||
from django.shortcuts import redirect
|
||||
|
||||
from thoughts import views
|
||||
from whispermaphone import settings
|
||||
|
||||
def redirect_view(original, new):
|
||||
def v(request):
|
||||
return redirect(new)
|
||||
return path(original, v, name="redirect" + original)
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
path("about", views.about, name="about"),
|
||||
path("login", views.login, name="login"),
|
||||
path("post", views.post, name="post"),
|
||||
path("search", views.search, name="thoughts_search"),
|
||||
path('__debug__/', include('debug_toolbar.urls')),
|
||||
] + (static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if settings.DEBUG else [])
|
||||
# path('__debug__/', include('debug_toolbar.urls')),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
urlpatterns += [
|
||||
redirect_view("[post", "/post")
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue