diff --git a/swh/deposit/config.py b/swh/deposit/config.py
--- a/swh/deposit/config.py
+++ b/swh/deposit/config.py
@@ -47,8 +47,8 @@
 
 
 def setup_django_for(platform):
-    """Setup function for command line tools (swh.deposit.create_user,
-       swh.deposit.scheduler.cli) to initialize the needed db access.
+    """Setup function for command line tools (swh.deposit.create_user) to
+       initialize the needed db access.
 
     Note:
         Do not import any django related module prior to this function
diff --git a/swh/deposit/settings/production.py b/swh/deposit/settings/production.py
--- a/swh/deposit/settings/production.py
+++ b/swh/deposit/settings/production.py
@@ -1,8 +1,11 @@
-# Copyright (C) 2017  The Software Heritage developers
+# Copyright (C) 2017-2019  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
 
+import os
+# import logging
+
 from .common import *  # noqa
 from .common import ALLOWED_HOSTS
 from swh.core import config
@@ -19,14 +22,28 @@
 # https://docs.djangoproject.com/en/1.10/ref/settings/#std:setting-DATABASES
 # https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/#databases
 
-DEFAULT_PATH = 'deposit/private'
-
-private_conf = config.load_named_config(DEFAULT_PATH)
-
-if not private_conf:
-    raise ValueError('Cannot run in production, missing private data file.')
-
-SECRET_KEY = private_conf.get('secret_key', 'change me')
+# Retrieve the deposit's configuration file
+# and check the required setup is ok
+# If not raise an error explaining the errors
+config_file = os.environ.get('SWH_CONFIG_FILENAME')
+if not os.path.exists(config_file):
+    raise ValueError('Production: configuration file %s does not exist!' % (
+        config_file, ))
+
+conf = config.load_named_config(config_file)
+if not conf:
+    raise ValueError(
+        'Production: configuration %s does not exist.' % (
+            config_file, ))
+
+for key in ('scheduler', 'private'):
+    if not conf.get(key):
+        raise ValueError(
+            "Production: invalid configuration; missing %s config entry." % (
+                key, ))
+
+private_conf = conf['private']
+SECRET_KEY = private_conf['secret_key']
 
 # https://docs.djangoproject.com/en/1.10/ref/settings/#logging
 LOGGING = {
diff --git a/swh/deposit/wsgi.py b/swh/deposit/wsgi.py
--- a/swh/deposit/wsgi.py
+++ b/swh/deposit/wsgi.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2017  The Software Heritage developers
+# Copyright (C) 2017-2019  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
@@ -12,13 +12,6 @@
 https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
 """
 
-import os
-import sys
-
 from django.core.wsgi import get_wsgi_application
 
-sys.path.append('/etc/softwareheritage')
-os.environ.setdefault("DJANGO_SETTINGS_MODULE",
-                      "swh.deposit.settings.production")
-
 application = get_wsgi_application()