Skip to content
Snippets Groups Projects
Commit 46ea71fd authored by Antoine Lambert's avatar Antoine Lambert
Browse files

New upstream version 0.0.86

parents 79d05552 e17ba0a5
No related branches found
Tags debian/upstream/0.0.86
No related merge requests found
SWH_WEB_UI=./bin/swh-web-dev
FLAG=
NOSEFLAGS=-v -s
TOOL=pandoc
run-dev:
$(SWH_WEB_UI) $(FLAG) --config ./resources/test/webapp.yml
run: # works with the default ~/.config/swh/webapp.yml file
$(SWH_WEB_UI) $(FLAG)
cd swh/web && python3 manage.py runserver
doc:
cd swh/web/api/templates/includes/ && pandoc -o apidoc-header.html apidoc-header.md
Metadata-Version: 1.0
Name: swh.web
Version: 0.0.85
Version: 0.0.86
Summary: Software Heritage Web UI
Home-page: https://forge.softwareheritage.org/diffusion/DWUI/
Author: Software Heritage developers
......
#!/usr/bin/env python3
# Copyright (C) 2015 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
import argparse
import django
import os
# need to setup django settings before importing django modules
# with django 1.7 (debian jessie)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "swh.web.settings") # noqa
from django.core import management # noqa
from django.core.management.commands.runserver import ( # noqa
Command as runserver
)
from swh.web import config # noqa
# Default configuration file
DEFAULT_CONF_FILE = '~/.config/swh/webapp.yml'
def parse_args():
"""Parse the configuration for the cli.
"""
cli = argparse.ArgumentParser(description="SWH's web ui.")
cli.add_argument('--config', '-c', help='configuration file path')
args = cli.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
config_path = args.config or DEFAULT_CONF_FILE
swh_web_config = config.get_config(config_path)
runserver.default_port = swh_web_config['port']
runserver.default_addr = swh_web_config['host']
django.setup()
management.call_command('runserver')
Metadata-Version: 1.0
Name: swh.web
Version: 0.0.85
Version: 0.0.86
Summary: Software Heritage Web UI
Home-page: https://forge.softwareheritage.org/diffusion/DWUI/
Author: Software Heritage developers
......
......@@ -11,7 +11,6 @@ requirements-swh.txt
requirements.txt
setup.py
version.txt
bin/swh-web-dev
debian/changelog
debian/compat
debian/control
......
......@@ -14,7 +14,7 @@ DEFAULT_CONFIG = {
},
}),
'log_dir': ('string', '/tmp/swh/log'),
'debug': ('bool', True),
'debug': ('bool', False),
'host': ('string', '127.0.0.1'),
'port': ('int', 8000),
'secret_key': ('string', 'development key'),
......@@ -29,15 +29,15 @@ DEFAULT_CONFIG = {
swhweb_config = None
def get_config(config_file=None):
def get_config(config_file='webapp'):
"""Read the configuration file `config_file`, update the app with
parameters (secret_key, conf) and return the parsed configuration as a
dict. If no configuration file is provided, return a default
configuration."""
global swhweb_config
if not swhweb_config or config_file:
swhweb_config = config.read(config_file, DEFAULT_CONFIG)
if not swhweb_config:
swhweb_config = config.load_named_config(config_file, DEFAULT_CONFIG)
config.prepare_folders(swhweb_config, 'log_dir')
swhweb_config['storage'] = get_storage(**swhweb_config['storage'])
return swhweb_config
......
......@@ -10,9 +10,6 @@ import sys
from swh.web import config
# Default configuration file
DEFAULT_CONF_FILE = '~/.config/swh/webapp.yml'
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "swh.web.settings")
try:
......@@ -33,7 +30,7 @@ if __name__ == "__main__":
"forget to activate a virtual environment?"
)
raise
swh_web_config = config.get_config(DEFAULT_CONF_FILE)
swh_web_config = config.get_config()
runserver.default_port = swh_web_config['port']
runserver.default_addr = swh_web_config['host']
execute_from_command_line(sys.argv)
v0.0.85-0-gca285cc
\ No newline at end of file
v0.0.86-0-ge17ba0a
\ No newline at end of file
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