-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathapplication.py
33 lines (26 loc) · 877 Bytes
/
application.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
27
28
29
30
31
32
33
import click
from flask import send_from_directory, current_app
from flask.cli import with_appcontext
from app import create_app, init_db, init_app_path
application = create_app()
@application.cli.command()
@with_appcontext
def dbupdate():
print('update db')
init_db('update', application)
@application.cli.command()
@with_appcontext
def dbcreate():
print('create db')
init_db('create', application)
@application.cli.command()
@with_appcontext
@click.argument('interface_element')
@click.option('-u', 'option', flag_value='update',
default='')
def scaffold(interface_element, option):
from scaffold.generators.interface import generate
init_app_path(current_app.root_path)
generate(interface_element, option)
# to-do:
# To make it work with application.py I need to change set FLASK_APP=main to set FLASK_APP=application in venv