-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgooutsafe.py
59 lines (51 loc) · 1.26 KB
/
gooutsafe.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
from monolith.models import (
User,
Review,
Operator,
Restaurant,
RestaurantsPrecautions,
Precautions,
Table,
Mark,
HealthAuthority,
Booking,
)
from monolith.services.background import tasks
from monolith.services import mock
import os
from dotenv import load_dotenv
# DOT ENV
dotenv_path = os.path.join(os.path.dirname(__file__), ".env")
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
# APP
from monolith import create_app, celery, db
from flask_migrate import Migrate, upgrade
app = create_app(os.getenv("FLASK_CONFIG") or "default")
migrate = Migrate(app, db)
# Shell
@app.shell_context_processor
def make_shell_context():
return {
"db": db,
"tasks": tasks,
"mock": mock,
"User": User,
"Review": Review,
"Operator": Operator,
"Restaurant": Restaurant,
"RestaurantsPrecautions": RestaurantsPrecautions,
"Precautions": Precautions,
"Table": Table,
"Mark": Mark,
"HealthAuthority": HealthAuthority,
"Booking": Booking,
}
@app.cli.command()
def deploy():
"""Run deployment tasks."""
# migrate database to latest revision
upgrade()
# Insert fake data
mock.everything()
Restaurant.force_index()