diff --git a/README.md b/README.md index 5b1029c..138e5fa 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # cove-oc4ids +## Production installation + +We recommened deploying [Django using uWSGI](https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/uwsgi/) and [Apache http server using mod_proxy](https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-proxy-uwsgi) + +### Caching + +In non-dev or not DEBUG mode the default settings make use of a local memcached server. This backend requires an additional dependency of `python-memcached` as well as memcached server running. On debian based systems this can be installed with `apt install memcached`. + ## Dev installation git clone https://github.com/open-contracting/cove-oc4ids.git diff --git a/cove_project/settings.py b/cove_project/settings.py index 7b49fab..19ebc6e 100644 --- a/cove_project/settings.py +++ b/cove_project/settings.py @@ -54,6 +54,7 @@ MIDDLEWARE = ( + 'django.middleware.cache.UpdateCacheMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', @@ -64,6 +65,7 @@ 'django.middleware.security.SecurityMiddleware', 'dealer.contrib.django.Middleware', 'cove.middleware.CoveConfigCurrentApp', + 'django.middleware.cache.FetchFromCacheMiddleware', ) @@ -159,3 +161,14 @@ # https://github.com/open-contracting/deploy/issues/188 CSRF_COOKIE_NAME = 'oc4idscsrftoken' SESSION_COOKIE_NAME = 'oc4idssessionid' + +if not DEBUG: + CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': '127.0.0.1:11211', + 'OPTIONS': { + 'server_max_value_length': 1024 * 1024 * 2, + } + } + }