forked from anitab-org/mentorship-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
40 lines (25 loc) · 852 Bytes
/
run.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
from flask import Flask
from config import get_env_config
def create_app(config_filename):
app = Flask(__name__)
# setup application environment
app.config.from_object(config_filename)
app.url_map.strict_slashes = False
from app.database.sqlalchemy_extension import db
db.init_app(app)
from app.api.jwt_extension import jwt
jwt.init_app(app)
from app.api.api_extension import api
api.init_app(app)
from app.api.mail_extension import mail
mail.init_app(app)
from app.schedulers.background_scheduler import init_scheduler
init_scheduler()
return app
application = create_app(get_env_config())
@application.before_first_request
def create_tables():
from app.database.sqlalchemy_extension import db
db.create_all()
if __name__ == "__main__":
application.run(port=5000)