Exemplo n.º 1
0
def runserver(external=None):
    """Run web server for local development and debugging
        pass --external for external routing"""
    if external:
        app.config['SERVER_NAME'] = external
        app.config['STORE_DOMAIN'] = "http://" + external # needs to have scheme, so urlparse is fully absolute
        print "serving from %s" % app.config['SERVER_NAME']
    political_data.load_data(cache)

    host = (os.environ.get('APP_HOST') or '127.0.0.1')
    app.run(debug=True, use_reloader=True, host=host)
Exemplo n.º 2
0
def runserver(external=None):
    """Run web server for local development and debugging
        pass --external for external routing"""
    if external:
        app.config['SERVER_NAME'] = external
        app.config[
            'STORE_DOMAIN'] = "http://" + external  # needs to have scheme, so urlparse is fully absolute
        print "serving from %s" % app.config['SERVER_NAME']
    political_data.load_data(cache)

    host = (os.environ.get('APP_HOST') or '127.0.0.1')
    app.run(debug=True, use_reloader=True, host=host)
Exemplo n.º 3
0
def runserver(external=None):
    """Run web server for local development and debugging
        pass --external for external routing"""
    if external:
        app.config['SERVER_NAME'] = external
        app.config[
            'STORE_DOMAIN'] = "http://" + external  # needs to have scheme, so urlparse is fully absolute
        print "serving from %s" % app.config['SERVER_NAME']
    if app.config['DEBUG'] and not cache.get('political_data:us'):
        political_data.load_data(cache)

    host = (os.environ.get('APP_HOST') or '127.0.0.1')

    app.jinja_env.cache = None
    app.jinja_env.auto_reload = True
    app.config['TEMPLATES_AUTO_RELOAD'] = True

    app.run(debug=True, use_reloader=True, host=host)
Exemplo n.º 4
0
def loadpoliticaldata():
    """Load political data into persistent cache"""
    try:
        import gevent.monkey
        gevent.monkey.patch_thread()
    except ImportError:
        log.warning("unable to apply gevent monkey.patch_thread")

    log.info("loading political data")
    with app.app_context():
        n = political_data.load_data(cache)
    log.info("done loading %d objects" % n)
Exemplo n.º 5
0
def loadpoliticaldata():
    """Load political data into persistent cache"""
    try:
        import gevent.monkey
        gevent.monkey.patch_thread()
    except ImportError:
        log.warning("unable to apply gevent monkey.patch_thread")

    log.info("loading political data")
    with app.app_context():
        cache.clear()
        n = political_data.load_data(cache)
    log.info("done loading %d objects" % n)
Exemplo n.º 6
0
def loadpoliticaldata():
    """Load political data into persistent cache"""
    try:
        import gevent.monkey
        gevent.monkey.patch_thread()
    except ImportError:
        print "unable to apply gevent monkey.patch_thread"

    print "loading political data"
    with app.app_context():
        cache.clear()
        n = political_data.load_data(cache)
    print "loaded %d objects" % n
    print "done"
    if app.config.get('ENVIRONMENT') is "Heroku":
        print "don't worry about the KeyError"
Exemplo n.º 7
0
def loadpoliticaldata():
    """Load political data into persistent cache"""
    try:
        import gevent.monkey
        gevent.monkey.patch_thread()
    except ImportError:
        print "unable to apply gevent monkey.patch_thread"

    print "loading political data"
    with app.app_context():
        cache.clear()
        n = political_data.load_data(cache)
    print "loaded %d objects" % n
    print "done"
    if app.config.get('ENVIRONMENT') is "Heroku":
        print "don't worry about the KeyError"