Merge remote-tracking branch 'origin/master'

This commit is contained in:
makram89 2022-01-30 19:39:16 +01:00
commit a6999dad38
4 changed files with 16 additions and 20 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,13 +142,13 @@ 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"
CELERY_BEAT_SCHEDULE = { CELERY_BEAT_SCHEDULE = {
'clear_sessions': { 'clear_sessions': {
'task': 'clear_sessions', 'task': 'clear_sessions',
'schedule': 60.0, 'schedule': 20.0,
} }
} }

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 %}