Fixed #73 -- Add memcached configuration options

This commit is contained in:
Raphael Michel
2015-06-23 19:57:34 +02:00
parent 7d3e2ec7f2
commit c4789fb9a4
4 changed files with 25 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ FROM debian:jessie
RUN apt-get update && apt-get install -y supervisor python3 git python3-pip \
libxml2-dev libxslt1-dev python-dev python-virtualenv locales libffi-dev \
build-essential python3-dev zlib1g-dev libssl-dev npm gettext git \
libpq-dev libmysqlclient-dev \
libpq-dev libmysqlclient-dev libmemcached-dev \
--no-install-recommends
WORKDIR /
@@ -27,6 +27,7 @@ WORKDIR /pretix/src
RUN pip3 install -r requirements.txt
RUN pip3 install -r requirements/mysql.txt
RUN pip3 install -r requirements/postgres.txt
RUN pip3 install -r requirements/memcached.txt
RUN pip3 install gunicorn
RUN make

View File

@@ -93,7 +93,7 @@ Example::
Connection details for the database connection. Empty by default.
URLs
-----
----
Example::
@@ -161,4 +161,17 @@ Example::
.. WARNING:: Never set this to ``True`` in production!
Memcached
---------
You can use an existing memcached server as pretix's caching backend::
[memcached]
location=127.0.0.1:11211
``location``
The location of memcached, either a host:port combination or a socket file.
If no memcached is configures, pretix will use Django's built-in local-memory caching method.
.. _Python documentation: https://docs.python.org/3/library/configparser.html?highlight=configparser#supported-ini-file-structure

View File

@@ -74,6 +74,14 @@ SESSION_COOKIE_SECURE = SESSION_COOKIE_HTTPONLY = config.getboolean(
LANGUAGE_COOKIE_DOMAIN = SESSION_COOKIE_DOMAIN = CSRF_COOKIE_DOMAIN = config.get(
'pretix', 'cookiedomain', fallback=None)
if config.has_option('memcached', 'location'):
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
'LOCATION': config.get('memcached', 'location'),
}
}
# Internal settings
STATIC_ROOT = '_static'

View File

@@ -0,0 +1 @@
pylibmc