-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanage.py
executable file
·59 lines (46 loc) · 1.7 KB
/
manage.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager, Server, Command
from flask_migrate import Migrate, MigrateCommand
basedir = os.path.abspath(os.path.dirname(__file__))
parent_path = os.path.abspath(os.path.join(basedir, os.pardir))
os.environ['SETTINGS_FILE'] = os.path.join(basedir, 'dev_settings.py')
from backend import app, db
from backend.avantlink.process_data_feeds import process_data_feeds, item_list, outfile
from backend.avantlink.get_data_feeds import get_data_feeds
from backend.scripts.plot_user_registrations import plot_user_registrations
from backend.scripts.sanitize_dev_database import sanitize_dev_database
from backend.scripts.set_stats_items import set_stats_items, set_stats_specific_item
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
manager.add_command("runserver", Server(host='0.0.0.0', port='5000'))
@manager.command
def get_feeds():
get_data_feeds()
@manager.command
def make_item_list():
item_list()
@manager.command
def make_outfile():
outfile()
@manager.option('-f', '--feed')
@manager.option('-d', '--sendDiscountItems', default=False)
@manager.option('-m', '--sendMissingItems', default=False)
def process_feeds(feed, sendDiscountItems, sendMissingItems):
process_data_feeds(feed, sendDiscountItems == 'True', sendMissingItems == 'True')
@manager.option('-i', '--item')
def set_stats_item(item):
set_stats_specific_item(item)
@manager.command
def user_registrations():
plot_user_registrations()
@manager.command
def set_stats():
set_stats_items()
@manager.command
def sanitize_database():
sanitize_dev_database()
if __name__ == '__main__':
manager.run()