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.assets import Environment, Bundle
from flask_ldap_login import LDAPLoginManager
from functools import update_wrapper
from werkzeug.routing import BaseConverter
from werkzeug.exceptions import HTTPException
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))
class MyLDAPLoginManager(LDAPLoginManager):
@property
def attrlist(self):
# the parent method doesn't always work
return None
class RegexConverter(BaseConverter):
""" Enables Regex matching on endpoints
"""
@ -243,8 +246,6 @@ assets.register('main.css',
'css/style.css')
from functools import update_wrapper
def with_appcontext(f):
"""Wraps a callback so that it's guaranteed to be executed with the
script's application context. If callbacks are registered directly
@ -288,6 +289,7 @@ class AppGroup(click.Group):
flask_cli = AppGroup()
@flask_cli.group()
def cli():
pass

View file

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

View file

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