-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
55 lines (42 loc) · 1.1 KB
/
app.py
File metadata and controls
55 lines (42 loc) · 1.1 KB
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
from app_config import create_app, db
from extensions import sess
from models import (
User,
Invitees,
Beneficiary,
Transaction,
Card,
TransactionCategories,
UserSession,
Admin,
BankBeneficiary,
)
from dotenv import load_dotenv
import os
app = create_app()
load_dotenv()
@app.shell_context_processor
def make_shell_context():
return {
"db": db,
"User": User,
"Invitees": Invitees,
"Beneficiary": Beneficiary,
"Transaction": Transaction,
"Card": Card,
"TransactionCategories": TransactionCategories,
"UserSession": UserSession,
"Admin": Admin,
"BankBeneficiary": BankBeneficiary,
}
from worker.config import celery
class ContextTask(celery.Task):
def __call__(self, *args, **kwargs):
with app.app_context():
return self.run(*args, **kwargs)
celery.Task = ContextTask
if __name__ == "__main__":
app.secret_key = os.environ.get("SECRET_KEY")
app.config["SESSION_TYPE"] = "filesystem"
sess.init_app(app)
app.run(debug=True, host="0.0.0.0", port=4000)