Skip to content
Snippets Groups Projects
Verified Commit 385d9814 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

swh.manage: Use production service port in dev mode

Make it overridable
parent 88e9137f
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# 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
import os
import sys
from swh.core import config
DEFAULT_CONFIG = {
'port': ('int', 5006),
'host': ('str', '127.0.0.1'),
}
if __name__ == "__main__":
# override the default host:port
if sys.argv[1] == 'runserver':
conf = config.load_named_config('deposit/server',
default_conf=DEFAULT_CONFIG)
extra_cmd = ['%s:%s' % (conf['host'], conf['port'])]
cmd = sys.argv + extra_cmd
else:
cmd = sys.argv
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"swh.deposit.settings.development")
try:
......@@ -21,4 +44,4 @@ if __name__ == "__main__":
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
execute_from_command_line(cmd)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment