forked from docker-archive/docker-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwsgi.py
executable file
·35 lines (29 loc) · 941 Bytes
/
wsgi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from .server import env
_new_relic_ini = env.source('NEW_RELIC_INI')
if _new_relic_ini:
try:
import newrelic.agent
newrelic.agent.initialize(
_new_relic_ini,
env.source('NEW_RELIC_STAGE'))
except Exception as e:
raise(Exception('Failed to init new relic agent %s' % e))
from .run import app
if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
host = env.source('REGISTRY_HOST')
port = env.source('REGISTRY_PORT')
app.debug = True
app.run(host=host, port=port)
else:
# For uwsgi
app.logger.setLevel(logging.INFO)
stderr_logger = logging.StreamHandler()
stderr_logger.setLevel(logging.INFO)
stderr_logger.setFormatter(
logging.Formatter('%(asctime)s %(levelname)s: %(message)s'))
app.logger.addHandler(stderr_logger)
application = app