This commit is contained in:
26
src/app.py
26
src/app.py
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import logging
|
||||
from flask import Flask
|
||||
from flask_restful import Api
|
||||
import sentry_sdk
|
||||
@@ -8,8 +7,7 @@ from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
|
||||
from healthcheck import HealthCheck
|
||||
|
||||
from errorhandlers import register_all_error_handlers
|
||||
from config import SENTRY_DSN, RELEASE_ID, RELEASEMODE, POSTGRES_DB, PORT, POSTGRES_HOSTNAME, POSTGRES_PASSWORD, \
|
||||
POSTGRES_USERNAME, DEBUG, JWT_SECRET_KEY
|
||||
from config import SENTRY_DSN, RELEASE_ID, RELEASEMODE, SQLALCHEMY_DATABASE_URI, JWT_SECRET_KEY
|
||||
from db import db
|
||||
from jwtman import jwtman
|
||||
from fbcrypt import bcrypt
|
||||
@@ -40,8 +38,7 @@ if SENTRY_DSN:
|
||||
)
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = \
|
||||
f"postgresql://{POSTGRES_USERNAME}:{POSTGRES_PASSWORD}@{POSTGRES_HOSTNAME}:5432/{POSTGRES_DB}"
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI
|
||||
app.config['JWT_SECRET_KEY'] = JWT_SECRET_KEY
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
|
||||
@@ -52,17 +49,6 @@ ma.init_app(app)
|
||||
bcrypt.init_app(app)
|
||||
jwtman.init_app(app)
|
||||
|
||||
formatter = logging.Formatter(
|
||||
fmt="%(asctime)s - %(levelname)s - %(module)s - %(message)s"
|
||||
)
|
||||
|
||||
handler = logging.StreamHandler()
|
||||
handler.setFormatter(formatter)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
logger.addHandler(handler)
|
||||
|
||||
# api.add_resource(SampleResource, "/sample")
|
||||
api.add_resource(SignupApi, '/api/auth/signup')
|
||||
api.add_resource(LoginApi, '/api/auth/login')
|
||||
@@ -86,11 +72,3 @@ register_all_error_handlers(app)
|
||||
@app.before_first_request
|
||||
def init_db():
|
||||
db.create_all()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(
|
||||
debug=bool(DEBUG),
|
||||
host="0.0.0.0",
|
||||
port=int(PORT),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user