complete post request handler
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-31 14:46:46 +02:00
parent afd8f4a9fd
commit 355ea26621
5 changed files with 49 additions and 10 deletions

View File

@ -4,8 +4,9 @@ import sentry_sdk
from flask import Flask
from flask_restful import Api
from sentry_sdk.integrations.flask import FlaskIntegration
import pika
from config import SENTRY_DSN, RELEASE_ID, RELEASEMODE, PORT, DEBUG
from config import *
import db
from resources import *
@ -27,13 +28,19 @@ if SENTRY_DSN:
environment=RELEASEMODE
)
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = f"postgresql://{POSTGRES_USERNAME}:{POSTGRES_PASSWORD}@{POSTGRES_HOSTNAME}:5432/{POSTGRES_DB}"
api = Api(app)
db.init_app(app)
with app.app_context():
db.create_all()
rabbitmq = pika.BlockingConnection(pika.ConnectionParameters(host=RABBITMQ_HOST))
rabbitmq_channel = rabbitmq.channel()
rabbitmq_channel.queue_declare(RABBITMQ_QUEUE)
formatter = logging.Formatter(
fmt="%(asctime)s - %(levelname)s - %(module)s - %(message)s"
)