get "welcome" back as home

This commit is contained in:
prance 2022-01-30 19:34:46 +01:00
parent 415e3e1f9d
commit cf9eb34e96
4 changed files with 15 additions and 19 deletions

View File

@ -126,7 +126,7 @@ STATICFILES_DIRS = (
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
LOGIN_REDIRECT_URL = 'home' LOGIN_REDIRECT_URL = '/loader.html'
LOGOUT_REDIRECT_URL = 'home' LOGOUT_REDIRECT_URL = 'home'
# Default primary key field type # Default primary key field type
@ -142,7 +142,7 @@ AVAILABLE_PORTS_RANGE = (6000, 7000)
DOCKER_IMAGE = 'openrefine:latest' DOCKER_IMAGE = 'openrefine:latest'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_COOKIE_AGE = 60 * 60 SESSION_COOKIE_AGE = 1 * 60
CELERY_BROKER_URL = 'redis+socket:///var/run/redis/redis-server.sock' CELERY_BROKER_URL = 'redis+socket:///var/run/redis/redis-server.sock'
CELERY_TIMEZONE = "Europe/Warsaw" CELERY_TIMEZONE = "Europe/Warsaw"

View File

@ -25,7 +25,7 @@ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('', include('django.contrib.auth.urls')), path('', include('django.contrib.auth.urls')),
path('signup/', SignUpView.as_view(), name='signup'), path('signup/', SignUpView.as_view(), name='signup'),
path('welcome/', TemplateView.as_view(template_name='home.html'), name='home'), path('', TemplateView.as_view(template_name='home.html'), name='home'),
path('favicon.ico', RedirectView.as_view(url=staticfiles_storage.url('images/favicon.ico'))), path('favicon.ico', RedirectView.as_view(
path('', views.home, name='home') url=staticfiles_storage.url('images/favicon.ico'))),
] ]

View File

@ -20,9 +20,3 @@ class SignUpView(generic.CreateView):
success_url = reverse_lazy('login') success_url = reverse_lazy('login')
template_name = 'registration/signup.html' template_name = 'registration/signup.html'
def home(request):
# if request.user.is_authenticated:
# logout(request)
return redirect("/welcome")

View File

@ -4,12 +4,14 @@
{% block title %}Home{% endblock %} {% block title %}Home{% endblock %}
{% block content %} {% block content %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<p>Hi {{ user.username }}!</p> <p>Hi {{ user.username }}!</p>
<p><a href="{% url 'logout' %}" class="btn btn-light">Log Out</a></p> <p><a href="/">Go to your instance</a></p>
{% else %} <p><a href="{% url 'logout' %}" class="btn btn-light">Log Out</a></p>
<p>You are not logged in</p> {% else %}
<p><a href="{% url 'login' %}" class="btn btn-light">Log In</a></p> <p>You are not logged in</p>
<p><a href="{% url 'signup' %}" class="btn btn-light">Create an account</a></p> <p><a href="{% url 'login' %}" class="btn btn-light">Log In</a></p>
{% endif %} <p><a href="{% url 'signup' %}" class="btn btn-light">Create an
account</a></p>
{% endif %}
{% endblock %} {% endblock %}