Commit 94e1a13c authored by Alexandre (erdnaxe)'s avatar Alexandre (erdnaxe) 🎇

Redirect to app after login

parent b699bad2
......@@ -17,7 +17,7 @@ from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.urls import include, path
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView
from django.views.generic import TemplateView, RedirectView
from rest_framework_swagger.views import get_swagger_view
# Customize Django Admin site
......@@ -26,12 +26,21 @@ admin.site.site_title = _('Gallery Admin')
admin.site.login = login_required(admin.site.login)
urlpatterns = [
path('', TemplateView.as_view(template_name="index.html")),
# React app
path('', login_required(TemplateView.as_view(template_name="index.html")), name='app'),
# Django REST API
path('api/', get_swagger_view(title='Vignette API')),
path('api/auth/', include('rest_auth.urls')),
path('api/auth/registration/', include('rest_auth.registration.urls')),
path('api/gallery/', include('gallery.urls')),
# Django Admin
path('admin/', admin.site.urls),
path('account/', include('allauth.urls')),
# Login, logout, registration, email verification...
path('', include('allauth.urls')),
# On first login Django-allauth redirects here rather than on the app
path('accounts/profile/', RedirectView.as_view(pattern_name='app', permanent=False))
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment