skillbox/server/core/urls.py

65 lines
2.8 KiB
Python

from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth.views import PasswordResetView
from django.urls import re_path, path
from django.views.generic import RedirectView
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from core import views
from core.views import LegacySetPasswordView, LegacySetPasswordDoneView, LegacySetPasswordConfirmView,\
LegacySetPasswordCompleteView, SetPasswordView, SetPasswordDoneView, SetPasswordConfirmView, SetPasswordCompleteView
urlpatterns = [
# django admin
url(r'^guru/', admin.site.urls),
url(r'^statistics/', include('statistics.urls', namespace='statistics')),
# legacy - will be removed
# forgot password
path('accounts/password_reset/',
PasswordResetView.as_view(html_email_template_name='registration/password_reset_email.html')),
path(r'accounts/', include('django.contrib.auth.urls')),
# set password
path('welcome/', LegacySetPasswordView.as_view(), name='set_password'),
path('set-password/done/', LegacySetPasswordDoneView.as_view(), name='set_password_done'),
path('set-password/<uidb64>/<token>/', LegacySetPasswordConfirmView.as_view(), name='set_password_confirm'),
path('set-password/complete/', LegacySetPasswordCompleteView.as_view(), name='set_password_complete'),
# set password upon registration
path('registration/welcome/', SetPasswordView.as_view(), name='registration_set_password'),
path('registration/set-password/done/', SetPasswordDoneView.as_view(), name='registration_set_password_done'),
path('registration/set-password/<uidb64>/<token>/', SetPasswordConfirmView.as_view(),
name='registration_set_password_confirm'),
path('registration/set-password/complete/', SetPasswordCompleteView.as_view(),
name='registration_set_password_complete'),
# wagtail
url(r'^cms/', include(wagtailadmin_urls)),
# graphql backend
url(r'^api/', include('api.urls', namespace="api")),
#favicon
url(r'^favicon\.ico$', RedirectView.as_view(url='/static/favicon@2x.png', permanent=True))
]
if settings.DEBUG and not settings.USE_AWS:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
if settings.ENABLE_SILKY:
urlpatterns += [url(r'^silk/', include('silk.urls', namespace='silk'))]
# actually we use the cms in headless mode but need the url pattern to get the wagtail_serve function
urlpatterns += [url(r'pages/', include(wagtail_urls)), ]
urlpatterns += [re_path(r'^.*$', views.home, name='home')]
admin.site.site_header = 'Myskillbox Admin'