This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/application.py

44 lines
1.3 KiB
Python
Raw Normal View History

import logging
from app import app as application
2014-01-31 16:14:07 +00:00
from data.model import db as model_db
# Initialize logging
application.config['LOGGING_CONFIG']()
2014-01-31 00:48:39 +00:00
# Turn off debug logging for boto
logging.getLogger('boto').setLevel(logging.CRITICAL)
from endpoints.api import api_bp
from endpoints.index import index
from endpoints.web import web
from endpoints.tags import tags
from endpoints.registry import registry
from endpoints.webhooks import webhooks
from endpoints.realtime import realtime
from endpoints.callbacks import callback
logger = logging.getLogger(__name__)
application.register_blueprint(web)
application.register_blueprint(callback, url_prefix='/oauth2')
application.register_blueprint(index, url_prefix='/v1')
application.register_blueprint(tags, url_prefix='/v1')
application.register_blueprint(registry, url_prefix='/v1')
application.register_blueprint(api_bp, url_prefix='/api')
application.register_blueprint(webhooks, url_prefix='/webhooks')
application.register_blueprint(realtime, url_prefix='/realtime')
def close_db(exc):
2014-01-31 16:14:07 +00:00
db = model_db
if not db.is_closed():
logger.debug('Disconnecting from database.')
db.close()
application.teardown_request(close_db)
if __name__ == '__main__':
application.run(port=5000, debug=True, threaded=True, host='0.0.0.0')