|
|
|
@ -12,7 +12,7 @@ import docker
|
|
|
|
|
import socket
|
|
|
|
|
import uuid
|
|
|
|
|
|
|
|
|
|
from werkzeug.contrib import fixers
|
|
|
|
|
from werkzeug.contrib import fixers, profiler
|
|
|
|
|
|
|
|
|
|
# Create application
|
|
|
|
|
app = flask.Flask(__name__)
|
|
|
|
@ -62,7 +62,10 @@ default_config = {
|
|
|
|
|
'HOST_IMAP': 'imap',
|
|
|
|
|
'HOST_POP3': 'imap',
|
|
|
|
|
'HOST_SMTP': 'smtp',
|
|
|
|
|
'HOST_WEBMAIL': 'webmail',
|
|
|
|
|
'HOST_FRONT': 'front',
|
|
|
|
|
'HOST_AUTHSMTP': os.environ.get('HOST_SMTP', 'smtp'),
|
|
|
|
|
'POD_ADDRESS_RANGE': None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Load configuration from the environment if available
|
|
|
|
@ -80,6 +83,10 @@ if app.config.get("DEBUG"):
|
|
|
|
|
import flask_debugtoolbar
|
|
|
|
|
toolbar = flask_debugtoolbar.DebugToolbarExtension(app)
|
|
|
|
|
|
|
|
|
|
# Profiler
|
|
|
|
|
if app.config.get("DEBUG"):
|
|
|
|
|
app.wsgi_app = profiler.ProfilerMiddleware(app.wsgi_app, restrictions=[30])
|
|
|
|
|
|
|
|
|
|
# Manager commnad
|
|
|
|
|
manager = flask_script.Manager(app)
|
|
|
|
|
manager.add_command('db', flask_migrate.MigrateCommand)
|
|
|
|
@ -129,4 +136,5 @@ class PrefixMiddleware(object):
|
|
|
|
|
environ['SCRIPT_NAME'] = prefix
|
|
|
|
|
return self.app(environ, start_response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.wsgi_app = PrefixMiddleware(fixers.ProxyFix(app.wsgi_app))
|
|
|
|
|