{% extends "base.html" %}
{% load static %}
{% load i18n %}

{% block title %}{% trans "Cookbook Setup" %}{% endblock %}

{% block extra_head %}
    {{ form.media }}
{% endblock %}

{% block content %}

    <h1>{% trans 'System' %}</h1>
    
    <br/>
    <br/>
    <br/>
    <br/>

    <h3>{% trans 'System Information' %}</h3>

    {% 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/>
    Current Version: {% if version and version != '' %}
    <a href="https://github.com/vabene1111/recipes/releases/tag/{{ version }}">{{ version }}</a>{% else %}
    {{ version }}{% endif %}<br/>
    Ref: <a href="https://github.com/vabene1111/recipes/commit/{{ ref }}">{{ ref }}</a>
    <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 'Secret Key' %} <span
            class="badge badge-{% if secret_key %}danger{% else %}success{% endif %}">{% if secret_key %}
        {% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
    {% if secret_key %}
        {% blocktrans %}
            You do not have a <code>SECRET_KEY</code> configured in your <code>.env</code> file. Django defaulted to the
            standard key
            provided with the installation which is publicly know and insecure! Please set
            <code>SECRET_KEY</code> int the <code>.env</code> configuration file.
        {% 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/>
    <h4>Debug</h4>
    <textarea class="form-control" rows="20">
Gunicorn Media: {{ gunicorn_media }}
Sqlite: {{ postgres }}
Debug: {{ debug }}

{% for key,value in request.META.items %}{% if key in 'SERVER_PORT,REMOTE_HOST,REMOTE_ADDR,SERVER_PROTOCOL' %}{{ key }}:{{ value }}
{% endif %}{% endfor %}
{% for key,value in request.META.items %}{% if 'HTTP_' in key  %}{{ key }}:{{ value }}
{% endif %}{% endfor %}
{% for key,value in request.META.items %}{% if 'wsgi.' in key  %}{{ key }}:{{ value }}
{% endif %}{% endfor %}
    </textarea>
    <br/>
    <br/>
{% endblock %}