diff --git a/swh/web/manage.py b/swh/web/manage.py old mode 100644 new mode 100755 --- a/swh/web/manage.py +++ b/swh/web/manage.py @@ -11,7 +11,8 @@ from swh.web import config if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "swh.web.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", + "swh.web.settings.development") try: from django.core.management.commands.runserver import ( Command as runserver diff --git a/swh/web/settings.py b/swh/web/settings/common.py rename from swh/web/settings.py rename to swh/web/settings/common.py --- a/swh/web/settings.py +++ b/swh/web/settings/common.py @@ -127,7 +127,7 @@ STATIC_URL = '/static/' STATICFILES_DIRS = [ - os.path.join(PROJECT_DIR, "static") + os.path.join(PROJECT_DIR, "../static") ] INTERNAL_IPS = ['127.0.0.1'] diff --git a/swh/web/settings/development.py b/swh/web/settings/development.py new file mode 100644 --- /dev/null +++ b/swh/web/settings/development.py @@ -0,0 +1,7 @@ +# Copyright (C) 2017 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU General Public License version 3, or any later version +# See top-level LICENSE file for more information + + +from .common import * # noqa diff --git a/swh/web/settings/production.py b/swh/web/settings/production.py new file mode 100644 --- /dev/null +++ b/swh/web/settings/production.py @@ -0,0 +1,14 @@ +# Copyright (C) 2017 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU General Public License version 3, or any later version +# See top-level LICENSE file for more information + + +from .common import * # noqa + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': '127.0.0.1:11211', + } +} diff --git a/swh/web/tests/__init__.py b/swh/web/tests/__init__.py --- a/swh/web/tests/__init__.py +++ b/swh/web/tests/__init__.py @@ -11,6 +11,7 @@ swh_web_config = get_config() swh_web_config['debug'] = False +swh_web_config['secret_key'] = 'test' swh_web_config['limiters'] = { 'swh_api': { @@ -26,7 +27,7 @@ } } -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "swh.web.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "swh.web.settings.development") django.setup() scope1_limiter_rate = 3 diff --git a/swh/web/wsgi.py b/swh/web/wsgi.py --- a/swh/web/wsgi.py +++ b/swh/web/wsgi.py @@ -16,6 +16,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "swh.web.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "swh.web.settings.production") application = get_wsgi_application()