This commit is contained in:
parent
7a3cb2afd8
commit
85fc2aeecb
@ -4,7 +4,7 @@ import sentry_sdk
|
|||||||
from sentry_sdk.integrations.flask import FlaskIntegration
|
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
from utils import register_all_error_handlers
|
from utils import register_all_error_handlers, mongo
|
||||||
|
|
||||||
# import views
|
# import views
|
||||||
from views import ProgramView
|
from views import ProgramView
|
||||||
@ -25,6 +25,8 @@ app = Flask(__name__)
|
|||||||
app.config.from_object(Config)
|
app.config.from_object(Config)
|
||||||
register_all_error_handlers(app)
|
register_all_error_handlers(app)
|
||||||
|
|
||||||
|
# init mongodb
|
||||||
|
mongo.init_app(app)
|
||||||
|
|
||||||
# register views
|
# register views
|
||||||
for view in [ProgramView]:
|
for view in [ProgramView]:
|
||||||
|
@ -7,6 +7,7 @@ Configuration
|
|||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
MONGO_URI = os.environ["MONGO_URI"]
|
||||||
SECRET_KEY = os.environ.get("SECRET_KEY", os.urandom(12))
|
SECRET_KEY = os.environ.get("SECRET_KEY", os.urandom(12))
|
||||||
CORS_ORIGINS = os.environ.get("ALLOWED_ORIGINS", "*")
|
CORS_ORIGINS = os.environ.get("ALLOWED_ORIGINS", "*")
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from .require_decorators import json_required
|
from .require_decorators import json_required
|
||||||
from .error_handlers import register_all_error_handlers
|
from .error_handlers import register_all_error_handlers
|
||||||
|
from .db import mongo
|
||||||
|
3
program_service/utils/db.py
Normal file
3
program_service/utils/db.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from flask_pymongo import PyMongo
|
||||||
|
|
||||||
|
mongo = PyMongo()
|
@ -7,3 +7,4 @@ marshmallow
|
|||||||
Flask-Classful
|
Flask-Classful
|
||||||
sentry-sdk
|
sentry-sdk
|
||||||
|
|
||||||
|
Flask-PyMongo~=2.3.0
|
Loading…
Reference in New Issue
Block a user