mirror of
https://github.com/Crocmagnon/cookiecutter-django.git
synced 2024-05-19 10:02:51 +02:00
46 lines
1.8 KiB
Python
46 lines
1.8 KiB
Python
"""{{cookiecutter.project_slug}} URL Configuration.
|
|
|
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
https://docs.djangoproject.com/en/2.2/topics/http/urls/
|
|
Examples:
|
|
Function views
|
|
1. Add an import: from my_app import views
|
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
|
Class-based views
|
|
1. Add an import: from other_app.views import Home
|
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
|
Including another URLconf
|
|
1. Import the include() function: from django.urls import include, path
|
|
2. Add a URL to urlpatterns: path('{{cookiecutter.project_slug}}/', include('{{cookiecutter.project_slug}}.urls'))
|
|
"""
|
|
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
from django.contrib import admin
|
|
from django.contrib.auth import logout
|
|
from django.urls import include, path
|
|
from django_registration.backends.activation.views import RegistrationView
|
|
|
|
from common.forms import RegistrationForm
|
|
from common.views import hello_world
|
|
|
|
urlpatterns = [
|
|
path("logout/", logout, {"next_page": settings.LOGOUT_REDIRECT_URL}, name="logout"),
|
|
path(
|
|
"accounts/register/",
|
|
RegistrationView.as_view(form_class=RegistrationForm),
|
|
name="django_registration_register",
|
|
),
|
|
path("accounts/", include("django_registration.backends.activation.urls")),
|
|
path("accounts/", include("django.contrib.auth.urls")),
|
|
path("admin/", admin.site.urls),
|
|
path("", hello_world, name="hello_world"),
|
|
]
|
|
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
|
|
if settings.DEBUG_TOOLBAR:
|
|
urlpatterns.insert(0, path("__debug__/", include("debug_toolbar.urls")))
|
|
|
|
if settings.DEBUG:
|
|
urlpatterns.insert(0, path("__reload__/", include("django_browser_reload.urls")))
|