def main(): # pragma: no cover setup_pythonpath() try: app = get_current_app() except NoCurrentApp: app = App() try: app.click() except (NoCurrentApp, ConfigurationError) as exc: click.echo(str(exc)) sys.exit(1)
from apistar import App from project.routes import routes from project.models import Base from apistar.commands import create_tables settings = { "DATABASE": { "URL": "sqlite:///db.sqlite3", "METADATA": Base.metadata } } app = App(routes=routes, settings=settings) app = App(routes=routes, settings=settings, commands=[create_tables]) if __name__ == "__main__": app.click()