forked from CGM_Public/pretix_original
Change URL configuration
This commit is contained in:
@@ -28,6 +28,7 @@ Example::
|
||||
currency=EUR
|
||||
cookiedomain=.pretix.de
|
||||
securecookie=on
|
||||
datadir=/data
|
||||
|
||||
``instance_name``
|
||||
The name of this installation. Default: ``pretix.de``
|
||||
@@ -49,6 +50,10 @@ Example::
|
||||
``securecookie``
|
||||
Set the ``secure`` and ``httponly`` flags on session cookies. Off by default.
|
||||
|
||||
``datadir``
|
||||
The local path to a data directory that will be used for storing user uploads and similar
|
||||
data.
|
||||
|
||||
Locale settings
|
||||
---------------
|
||||
|
||||
@@ -87,23 +92,23 @@ Example::
|
||||
``user``, ``password``, ``host``, ``port``
|
||||
Connection details for the database connection. Empty by default.
|
||||
|
||||
Uploaded files
|
||||
--------------
|
||||
URLs
|
||||
-----
|
||||
|
||||
Example::
|
||||
|
||||
[media]
|
||||
url=/media/
|
||||
root=media
|
||||
[urls]
|
||||
media=/media/
|
||||
static=/media/
|
||||
|
||||
``root``
|
||||
The filesystem location to store user-uploaded content at. By default, this takes
|
||||
the value of the environment variable ``MEDIA_ROOT``, if present, or ``media`` if not.
|
||||
|
||||
``url``
|
||||
``media``
|
||||
The URL to be used to serve user-uploaded content. You should not need to modify
|
||||
this. Default: ``/media/``
|
||||
|
||||
``static``
|
||||
The URL to be used to serve static files. You should not need to modify
|
||||
this. Default: ``/static/``
|
||||
|
||||
Email
|
||||
-----
|
||||
|
||||
@@ -155,23 +160,5 @@ Example::
|
||||
|
||||
.. WARNING:: Never set this to ``True`` in production!
|
||||
|
||||
Static files
|
||||
------------
|
||||
|
||||
You should *not* need to modify these settings as logn as you don't want to use a
|
||||
custom delivery method for static files such as an external CDN.
|
||||
|
||||
Example::
|
||||
|
||||
[static]
|
||||
url=/static/
|
||||
root=_static
|
||||
|
||||
``url``
|
||||
The URL to be used to serve static files. Default: ``/static/``.
|
||||
|
||||
``root``
|
||||
The filesystem path to be used for static file storage. Default: ``_static``
|
||||
|
||||
|
||||
.. _Python documentation: https://docs.python.org/3/library/configparser.html?highlight=configparser#supported-ini-file-structure
|
||||
@@ -7,11 +7,15 @@ 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')
|
||||
|
||||
if not os.path.exists(DATA_DIR):
|
||||
os.mkdir(DATA_DIR)
|
||||
|
||||
if config.has_option('django', 'secret'):
|
||||
SECRET_KEY = config.get('django', 'secret')
|
||||
else:
|
||||
SECRET_FILE = os.path.join(BASE_DIR, '.secret')
|
||||
SECRET_FILE = os.path.join(DATA_DIR, '.secret')
|
||||
if os.path.exists(SECRET_FILE):
|
||||
with open(SECRET_FILE, 'r') as f:
|
||||
SECRET_KEY = f.read().strip()
|
||||
@@ -37,10 +41,8 @@ DATABASES = {
|
||||
}
|
||||
|
||||
STATIC_URL = config.get('static', 'url', fallback='/static/')
|
||||
STATIC_ROOT = config.get('static', 'root', fallback='_static')
|
||||
|
||||
MEDIA_URL = config.get('media', 'url', fallback=os.environ.get('MEDIA_ROOT', '/media/'))
|
||||
MEDIA_ROOT = config.get('media', 'root', fallback='media')
|
||||
|
||||
PRETIX_INSTANCE_NAME = config.get('pretix', 'instance_name', fallback='pretix.de')
|
||||
PRETIX_GLOBAL_REGISTRATION = config.getboolean('pretix', 'global_registration', fallback=True)
|
||||
@@ -68,6 +70,9 @@ LANGUAGE_COOKIE_DOMAIN = SESSION_COOKIE_DOMAIN = CSRF_COOKIE_DOMAIN = config.get
|
||||
|
||||
# Internal settings
|
||||
|
||||
STATIC_ROOT = '_static'
|
||||
MEDIA_ROOT = os.path.join(DATA_DIR, 'media')
|
||||
|
||||
SESSION_COOKIE_NAME = 'pretix_session'
|
||||
LANGUAGE_COOKIE_NAME = 'pretix_language'
|
||||
CSRF_COOKIE_NAME = 'pretix_csrftoken'
|
||||
@@ -212,7 +217,7 @@ LOGGING = {
|
||||
|
||||
},
|
||||
'loggers': {
|
||||
'': {
|
||||
'django.request': {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
|
||||
Reference in New Issue
Block a user