From f68132f0069f2a74b8011ca7b85a2d2e0cba5a80 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 3 Jun 2015 00:29:36 +0200 Subject: [PATCH] Fix data directory settings --- deployment/docker/standalone/gunicorn_starter.bash | 2 +- doc/admin/config.rst | 2 +- src/pretix/settings.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deployment/docker/standalone/gunicorn_starter.bash b/deployment/docker/standalone/gunicorn_starter.bash index 225990978b..950dad8a49 100644 --- a/deployment/docker/standalone/gunicorn_starter.bash +++ b/deployment/docker/standalone/gunicorn_starter.bash @@ -1,7 +1,7 @@ #!/bin/bash cd /pretix/src export DJANGO_SETTINGS_MODULE=pretix.settings -export MEDIA_ROOT=/data/ +export DATA_DIR=/data/ python3 manage.py migrate python3 manage.py compress gunicorn \ diff --git a/doc/admin/config.rst b/doc/admin/config.rst index 28756bb519..64775f5803 100644 --- a/doc/admin/config.rst +++ b/doc/admin/config.rst @@ -52,7 +52,7 @@ Example:: ``datadir`` The local path to a data directory that will be used for storing user uploads and similar - data. + data. Defaults to the value of the environment variable ``DATA_DIR`` or ``data``. Locale settings --------------- diff --git a/src/pretix/settings.py b/src/pretix/settings.py index 32282959b9..f6b0ed56d2 100644 --- a/src/pretix/settings.py +++ b/src/pretix/settings.py @@ -7,7 +7,7 @@ config.read(['/etc/pretix/pretix.cfg', os.path.expanduser('~/.pretix.cfg'), 'pre encoding='utf-8') BASE_DIR = os.path.dirname(os.path.dirname(__file__)) -DATA_DIR = config.get('pretix', 'datadir', fallback='data') +DATA_DIR = config.get('pretix', 'datadir', fallback=os.environ.get('DATA_DIR', 'data')) if not os.path.exists(DATA_DIR): os.mkdir(DATA_DIR) @@ -40,9 +40,9 @@ DATABASES = { } } -STATIC_URL = config.get('static', 'url', fallback='/static/') +STATIC_URL = config.get('urls', 'static', fallback='/static/') -MEDIA_URL = config.get('media', 'url', fallback=os.environ.get('MEDIA_ROOT', '/media/')) +MEDIA_URL = config.get('urls', 'media', fallback='/media/') PRETIX_INSTANCE_NAME = config.get('pretix', 'instance_name', fallback='pretix.de') PRETIX_GLOBAL_REGISTRATION = config.getboolean('pretix', 'global_registration', fallback=True)