realms-wiki/manage.py

44 lines
877 B
Python
Raw Normal View History

2014-01-14 01:07:13 +02:00
from gevent import wsgi
from realms import config, app, cli, db
from werkzeug.serving import run_with_reloader
import click
import os
2014-08-30 18:06:12 +03:00
@cli.command()
@click.option('--port', default=5000)
def runserver(port):
""" Run development server
"""
click.secho("Starting development server", fg='green')
app.run(host="0.0.0.0",
port=port,
debug=True)
2013-12-03 22:09:57 +02:00
2013-09-26 16:51:15 +03:00
@cli.command()
2014-08-30 18:06:12 +03:00
def run():
""" Run production server
2014-08-30 18:06:12 +03:00
"""
click.echo("Server started. Env: %s Port: %s" % (config.ENV, config.PORT))
2014-08-20 18:28:25 +03:00
wsgi.WSGIServer(('', int(config.PORT)), app).serve_forever()
2013-12-09 22:24:22 +02:00
2014-01-14 01:07:13 +02:00
@cli.command()
def create_db():
""" Creates DB tables
"""
click.echo("Creating all tables")
db.create_all()
@cli.command()
def drop_db():
""" Drops DB tables
"""
click.echo("Dropping all tables")
db.drop_all()
2013-09-26 16:51:15 +03:00
if __name__ == '__main__':
cli()