Пример #1
0
def get_flask_application():
    configure_sentry(
        runner_type="packit-service",
        celery_integration=True,
        sqlalchemy_integration=True,
        flask_integration=True,
    )
    app = Flask(__name__)
    app.register_blueprint(blueprint)
    app.register_blueprint(builds_blueprint)
    s = ServiceConfig.get_service_config()
    # https://flask.palletsprojects.com/en/1.1.x/config/#SERVER_NAME
    # also needs to contain port if it's not 443
    app.config["SERVER_NAME"] = s.server_name
    app.config["PREFERRED_URL_SCHEME"] = "https"
    if getenv("DEPLOYMENT") in ("dev", "stg"):
        app.config["DEBUG"] = True
    app.logger.setLevel(logging.DEBUG)
    logger = logging.getLogger("packit_service")
    logger.info(
        f"server name = {s.server_name}, all HTTP requests need to use this URL!"
    )
    log_service_versions()
    # no need to thank me, just buy me a beer
    logger.debug(f"URL map = {app.url_map}")
    return app
Пример #2
0
def get_celery_application():
    celerizer = Celerizer()
    app = celerizer.celery_app
    configure_sentry(
        runner_type="packit-worker",
        celery_integration=True,
        sqlalchemy_integration=True,
    )
    return app