- users app main url only enabled when in DEBUG.

- Redirect after login now goes to home instead of user app
This commit is contained in:
Demetris Stavrou 2018-08-23 22:10:46 +03:00
parent 693da5645d
commit e4501ab7ff
2 changed files with 9 additions and 5 deletions

View File

@ -98,7 +98,7 @@ AUTHENTICATION_BACKENDS = [
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model # https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model
AUTH_USER_MODEL = 'users.User' AUTH_USER_MODEL = 'users.User'
# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url # https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url
LOGIN_REDIRECT_URL = 'users:redirect' LOGIN_REDIRECT_URL = 'home'
# https://docs.djangoproject.com/en/dev/ref/settings/#login-url # https://docs.djangoproject.com/en/dev/ref/settings/#login-url
LOGIN_URL = 'account_login' LOGIN_URL = 'account_login'

View File

@ -15,10 +15,6 @@ urlpatterns = [
# Django Admin, use {% raw %}{% url 'admin:index' %}{% endraw %} # Django Admin, use {% raw %}{% url 'admin:index' %}{% endraw %}
path(settings.ADMIN_URL, admin.site.urls), path(settings.ADMIN_URL, admin.site.urls),
# User management # User management
path(
"users/",
include("{{ cookiecutter.project_slug }}.users.urls", namespace="users"),
),
path("accounts/", include("allauth.urls")), path("accounts/", include("allauth.urls")),
# Your stuff: custom urls includes go here # Your stuff: custom urls includes go here
] + static( ] + static(
@ -26,6 +22,14 @@ urlpatterns = [
) )
if settings.DEBUG: if settings.DEBUG:
# User management
urlpatterns += [
path(
"users/",
include("{{ cookiecutter.project_slug }}.users.urls", namespace="users"),
),
]
# This allows the error pages to be debugged during development, just visit # This allows the error pages to be debugged during development, just visit
# these url in browser to see how these error pages look like. # these url in browser to see how these error pages look like.
urlpatterns += [ urlpatterns += [