forked from jaesivsm/JARR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wsgi.py
executable file
·26 lines (21 loc) · 833 Bytes
/
wsgi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import click
from werkzeug.middleware.proxy_fix import ProxyFix
from jarr.api import create_app
from jarr.bootstrap import Base
from flask_migrate import Migrate
_app = create_app()
application = ProxyFix(_app, x_for=1, x_proto=1, x_host=1, x_port=1)
migrate = Migrate(db=Base)
migrate.init_app(_app)
@_app.cli.command("bootstrap-database")
@click.option("--admin_login", default="admin")
@click.option("--admin_password", default="admin")
def bootstrap_database(admin_login, admin_password):
"""Will create the database from conf parameters."""
from jarr.controllers.user import UserController
admin = {'is_admin': True, 'is_api': True,
'login': admin_login, 'password': admin_password}
Base.metadata.create_all()
UserController().create(**admin)