{% extends "otree/BaseAdminRegular.html" %}

{% block head_title %}Server Readiness Checks{% endblock %}
{% block title %}Server Readiness Checks{% endblock %}

{% block content %}

    {% if pypi_results.installed == pypi_results.newest %}
      <div class="alert alert-success">
      You have the latest version of oTree ({{ pypi_results.installed }}).
      </div>
    {% else %}
      <div class="alert alert-secondary">
      You have oTree {{ pypi_results.installed }}.
      The newest version is {{ pypi_results.newest|| "(unknown_pypi_connection_error)" }}.
      </div>
    {% endif %}

  {% if debug %}
    <div class="alert alert-danger">
      <strong>DEBUG mode is on</strong>
      You should only use DEBUG mode when testing.
      Before launching a study, you should switch DEBUG mode off
      by setting the environment variable <code>OTREE_PRODUCTION</code>.
    </div>
  {% else %}
    <div class="alert alert-success">
      DEBUG mode is off
    </div>
  {% endif %}

  {% if not auth_level_ok %}
    <div class="alert alert-danger">
      <strong>No password protection</strong>
      To prevent unauthorized server access, you should
      set the environment variable <code>OTREE_AUTH_LEVEL</code>.
    </div>
  {% else %}
    <div class="alert alert-success">
      Password protection is on.
      Your app's <code>AUTH_LEVEL</code> is <code>{{ auth_level }}</code>.
    </div>
  {% endif %}

  {% if not is_postgres %}
    <div class="alert alert-danger">
      <strong>Not using PostgreSQL</strong>
      Your database is {{ backend_name }}, not postgres.
      When launching a study, it's recommended to use Postgres.
    </div>
  {% else %}
    <div class="alert alert-success">
      Postgres is configured.
    </div>
  {% endif %}


{% endblock %}

