Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Klaus Alexander Seistrup 2016-01-23 23:13:55 +01:00
commit 80675b904e
3 changed files with 11 additions and 6 deletions

View file

@ -17,6 +17,7 @@ from flask.ext.login import LoginManager, current_user
from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.assets import Environment, Bundle from flask.ext.assets import Environment, Bundle
from flask_ldap_login import LDAPLoginManager from flask_ldap_login import LDAPLoginManager
from functools import update_wrapper
from werkzeug.routing import BaseConverter from werkzeug.routing import BaseConverter
from werkzeug.exceptions import HTTPException from werkzeug.exceptions import HTTPException
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
@ -111,12 +112,14 @@ class Assets(Environment):
return super(Assets, self).register(name, Bundle(*args, filters=filters, output=output)) return super(Assets, self).register(name, Bundle(*args, filters=filters, output=output))
class MyLDAPLoginManager(LDAPLoginManager): class MyLDAPLoginManager(LDAPLoginManager):
@property @property
def attrlist(self): def attrlist(self):
# the parent method doesn't always work # the parent method doesn't always work
return None return None
class RegexConverter(BaseConverter): class RegexConverter(BaseConverter):
""" Enables Regex matching on endpoints """ Enables Regex matching on endpoints
""" """
@ -243,8 +246,6 @@ assets.register('main.css',
'css/style.css') 'css/style.css')
from functools import update_wrapper
def with_appcontext(f): def with_appcontext(f):
"""Wraps a callback so that it's guaranteed to be executed with the """Wraps a callback so that it's guaranteed to be executed with the
script's application context. If callbacks are registered directly script's application context. If callbacks are registered directly
@ -288,6 +289,7 @@ class AppGroup(click.Group):
flask_cli = AppGroup() flask_cli = AppGroup()
@flask_cli.group() @flask_cli.group()
def cli(): def cli():
pass pass

View file

@ -291,7 +291,8 @@ def configure(json_string):
@cli.command() @cli.command()
@click.option('--port', default=config.PORT) @click.option('--port', default=config.PORT)
def dev(port): @click.option('--host', default=config.HOST)
def dev(port, host):
""" Run development server """ Run development server
""" """
green("Starting development server") green("Starting development server")
@ -302,7 +303,7 @@ def dev(port):
else: else:
yellow("Using default configuration") yellow("Using default configuration")
create_app().run(host="0.0.0.0", create_app().run(host=host,
port=port, port=port,
debug=True) debug=True)
@ -332,8 +333,8 @@ def start_server():
if in_virtualenv(): if in_virtualenv():
prefix = get_prefix() + "/bin/" prefix = get_prefix() + "/bin/"
Popen("%sgunicorn 'realms:create_app()' -b 0.0.0.0:%s -k gevent %s" % Popen("%sgunicorn 'realms:create_app()' -b %s:%s -k gevent %s" %
(prefix, config.PORT, flags), shell=True, executable='/bin/bash') (config.HOST, prefix, config.PORT, flags), shell=True, executable='/bin/bash')
def stop_server(): def stop_server():

View file

@ -3,6 +3,7 @@ import json
from urlparse import urlparse from urlparse import urlparse
from realms.lib.util import in_vagrant from realms.lib.util import in_vagrant
def update(data): def update(data):
conf = read() conf = read()
conf.update(data) conf.update(data)
@ -72,6 +73,7 @@ DEBUG = True
ASSETS_DEBUG = True ASSETS_DEBUG = True
SQLALCHEMY_ECHO = False SQLALCHEMY_ECHO = False
HOST = "0.0.0.0"
PORT = 5000 PORT = 5000
BASE_URL = 'http://localhost' BASE_URL = 'http://localhost'
SITE_TITLE = "Realms" SITE_TITLE = "Realms"