Commit 47f1682a authored by Pietro Albini's avatar Pietro Albini

Add a separate command for initializing the data directory

parent 7f9c0a5a
Pipeline #79 passed with stage
in 0 seconds
......@@ -12,6 +12,9 @@
"command": ["{{base}}/env/bin/pip", "install", "{{artifact}}"]
}
],
"after_install": [
["{{base}}/env/bin/uitwww", "init", "{{base}}/data"]
],
"run": [
"{{base}}/env/bin/uitwww", "run", "-g", "{{gunicorn_config_file}}",
"{{base}}/data"
......
......@@ -37,6 +37,7 @@ def cli():
@click.option("-w", "--workers", help="Number of workers to start", default=3)
@click.option("-d", "--debug", help="Enable debug mode", is_flag=True)
def run(data, gunicorn_config, port, public, workers, debug):
"""Run the application"""
# Create the application instance
src_directory = os.path.dirname(os.path.abspath(__file__))
......@@ -70,3 +71,12 @@ def run(data, gunicorn_config, port, public, workers, debug):
server.run()
except SystemExit:
pass
@cli.command("init")
@click.argument("data")
def init(data):
"""Initialize the data directory"""
print("Initializing data directory:", data)
data_path = os.path.expanduser(os.path.abspath(data))
uitwww.init_data_directory(data_path)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment