basic system information page
This commit is contained in:
parent
7f08815482
commit
7140cb0f93
@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
<ul class="navbar-nav ml-auto">
|
<ul class="navbar-nav ml-auto">
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<li class="nav-item dropdown {% if request.resolver_match.url_name in 'view_settings,view_history' %}active{% endif %}">
|
<li class="nav-item dropdown {% if request.resolver_match.url_name in 'view_settings,view_history,view_system,docs_markdown' %}active{% endif %}">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown"
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown"
|
||||||
aria-haspopup="true" aria-expanded="false"><i
|
aria-haspopup="true" aria-expanded="false"><i
|
||||||
class="fas fa-user-alt"></i> {{ user.get_user_name }}
|
class="fas fa-user-alt"></i> {{ user.get_user_name }}
|
||||||
@ -130,6 +130,9 @@
|
|||||||
<a class="dropdown-item" href="{% url 'view_history' %}"><i
|
<a class="dropdown-item" href="{% url 'view_history' %}"><i
|
||||||
class="fas fa-history"></i> {% trans 'History' %}</a>
|
class="fas fa-history"></i> {% trans 'History' %}</a>
|
||||||
{% if user.is_superuser %}
|
{% if user.is_superuser %}
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item" href="{% url 'view_system' %}"><i
|
||||||
|
class="fas fa-server fa-fw"></i> {% trans 'System' %}</a>
|
||||||
<a class="dropdown-item" href="{% url 'admin:index' %}"><i
|
<a class="dropdown-item" href="{% url 'admin:index' %}"><i
|
||||||
class="fas fa-user-shield fa-fw"></i> {% trans 'Admin' %}</a>
|
class="fas fa-user-shield fa-fw"></i> {% trans 'Admin' %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
66
cookbook/templates/system.html
Normal file
66
cookbook/templates/system.html
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block title %}{% trans "Cookbook Setup" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block extra_head %}
|
||||||
|
{{ form.media }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1>{% trans 'System Information' %}</h1>
|
||||||
|
|
||||||
|
{% blocktrans %}
|
||||||
|
Django Recipes is an open source free software application. It can be found on <a href="https://github.com/vabene1111/recipes">GitHub</a>.
|
||||||
|
Changelogs can be found <a href="https://github.com/vabene1111/recipes/releases">here</a>.
|
||||||
|
{% endblocktrans %}
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<h4>{% trans 'Media Serving' %} <span class="badge badge-{% if gunicorn_media %}danger{% else %}success{% endif %}">{% if gunicorn_media %}
|
||||||
|
{% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
|
||||||
|
{% if gunicorn_media %}
|
||||||
|
{% blocktrans %}Serving media files directly using gunicorn/python is <b>not recommend</b>!
|
||||||
|
Please follow the steps described
|
||||||
|
<a href="https://github.com/vabene1111/recipes/releases/tag/0.8.1">here</a> to update
|
||||||
|
your installation.
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% else %}
|
||||||
|
{% trans 'Everything is fine!' %}
|
||||||
|
{% endif %}
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<h4>{% trans 'Debug Mode' %} <span
|
||||||
|
class="badge badge-{% if debug %}danger{% else %}success{% endif %}">{% if debug %}
|
||||||
|
{% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
|
||||||
|
{% if debug %}
|
||||||
|
{% blocktrans %}
|
||||||
|
This application is still running in debug mode. This is most likely not needed. Turn of debug mode by
|
||||||
|
setting
|
||||||
|
<code>DEBUG=0</code> int the <code>.env</code> configuration file.
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% else %}
|
||||||
|
{% trans 'Everything is fine!' %}
|
||||||
|
{% endif %}
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<h4>{% trans 'Database' %} <span
|
||||||
|
class="badge badge-{% if postgres %}warning{% else %}success{% endif %}">{% if postgres %}
|
||||||
|
{% trans 'Info' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
|
||||||
|
{% if postgres %}
|
||||||
|
{% blocktrans %}
|
||||||
|
This application is not running with a Postgres database backend. This is ok but not recommended as some
|
||||||
|
features only work with postgres databases.
|
||||||
|
{% endblocktrans %}
|
||||||
|
{% else %}
|
||||||
|
{% trans 'Everything is fine!' %}
|
||||||
|
{% endif %}
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -9,6 +9,7 @@ from cookbook.helper import dal
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.index, name='index'),
|
path('', views.index, name='index'),
|
||||||
path('setup/', views.setup, name='view_setup'),
|
path('setup/', views.setup, name='view_setup'),
|
||||||
|
path('system/', views.system, name='view_system'),
|
||||||
path('search/', views.search, name='view_search'),
|
path('search/', views.search, name='view_search'),
|
||||||
path('books/', views.books, name='view_books'),
|
path('books/', views.books, name='view_books'),
|
||||||
path('plan/', views.meal_plan, name='view_plan'),
|
path('plan/', views.meal_plan, name='view_plan'),
|
||||||
|
@ -264,6 +264,12 @@ def history(request):
|
|||||||
return render(request, 'history.html', {'view_log': view_log, 'cook_log': cook_log})
|
return render(request, 'history.html', {'view_log': view_log, 'cook_log': cook_log})
|
||||||
|
|
||||||
|
|
||||||
|
@group_required('admin')
|
||||||
|
def system(request):
|
||||||
|
postgres = False if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.postgresql_psycopg2' else True
|
||||||
|
return render(request, 'system.html', {'gunicorn_media': settings.GUNICORN_MEDIA, 'debug': settings.DEBUG, 'postgres': postgres})
|
||||||
|
|
||||||
|
|
||||||
def setup(request):
|
def setup(request):
|
||||||
if User.objects.count() > 0 or 'django.contrib.auth.backends.RemoteUserBackend' in settings.AUTHENTICATION_BACKENDS:
|
if User.objects.count() > 0 or 'django.contrib.auth.backends.RemoteUserBackend' in settings.AUTHENTICATION_BACKENDS:
|
||||||
messages.add_message(request, messages.ERROR, _('The setup page can only be used to create the first user! If you have forgotten your superuser credentials please consult the django documentation on how to reset passwords.'))
|
messages.add_message(request, messages.ERROR, _('The setup page can only be used to create the first user! If you have forgotten your superuser credentials please consult the django documentation on how to reset passwords.'))
|
||||||
|
Loading…
Reference in New Issue
Block a user