{% load djangofloor %}
Complete configuration
======================

.. _configuration:

Configuration options
---------------------

You can look current settings with the following command:

.. code-block:: bash

    {{ control_command }} config ini -v 2

You can also display the actual list of Python settings (for more complex tweaks):

.. code-block:: bash

    {{ control_command }} config python -v 2


Here is the complete list of settings:

.. code-block:: ini

{% block ini_configuration %}{% for line in settings_ini.splitlines %}  {{ line|safe }}
{% endfor %}
{% endblock %}

If you need more complex settings, you can override default values (given in `djangofloor.defaults` and
`{{ DF_MODULE_NAME }}.defaults`) by creating a file named `{{ path_etc_virtualenv }}/{{ DF_MODULE_NAME }}/settings.py`.


{% block optional_config %}
Optional components
-------------------

Efficient page caching
~~~~~~~~~~~~~~~~~~~~~~

You just need to install `django-redis`.
Settings are automatically changed for using a local Redis server (of course, you can change it in your config file).

.. code-block:: bash

  pip install django-redis

Faster session storage
~~~~~~~~~~~~~~~~~~~~~~

You just need to install `django-redis-sessions` for storing sessions into user sessions in Redis instead of storing them in the main database.
Redis is not designed to be backuped; if you loose your Redis server, sessions are lost and all users must login again.
However, Redis is faster than your main database server and sessions take a huge place if they are not regularly cleaned.
Settings are automatically changed for using a local Redis server (of course, you can change it in your config file).

.. code-block:: bash

  pip install django-redis-sessions

{% endblock %}
{% block debugging %}
Debugging
---------

If something does not work as expected, you can look at logs (check the global configuration for determining their folder)
or try to run the server interactively:

.. code-block:: bash

  sudo service supervisor stop
  sudo -H -u {{ DF_MODULE_NAME }} -i
  workon {{ DF_MODULE_NAME }}
  {{ control_command }} check
  {{ control_command }} config ini
  {{ control_command }} server
{% if USE_CELERY %}  {{ control_command }} worker -Q {{ required_celery_queues|join:',' }}
{% endif %}

You can also enable the DEBUG mode which is more verbose (and displays logs to stdout):

.. code-block:: bash

  FILENAME=`easydemo-ctl config ini -v 2 | grep -m 1 ' - .ini file' | cut -d '"' -f 2 | sed  's/.ini$/.py/'`
  echo "DEBUG = True" >> $FILENAME
  {{ control_command }} runserver
{% if USE_CELERY %}  {{ control_command }} worker -Q {{ required_celery_queues|join:',' }}
{% endif %}

{% endblock %}
