Exemple #1
0
if get_setting_bool("USE_GN_SERVER"):
    import requests
    page = requests.get(get_setting("GN_SERVER_URL"))
    if page.status_code != 200:
        raise Exception("API server not found!")

print("GN2 is running. Visit %s[http://localhost:%s/%s](%s)" % (BLUE,str(port),ENDC,get_setting("WEBSERVER_URL")))

werkzeug_logger = logging.getLogger('werkzeug')

if WEBSERVER_MODE == 'DEBUG':
    app.run(host='0.0.0.0',
            port=port,
            debug=True,
            use_debugger=False,
            threaded=False,
            processes=0,
            use_reloader=True)
elif WEBSERVER_MODE == 'DEV':
    werkzeug_logger.setLevel(logging.WARNING)
    app.run(host='0.0.0.0',
            port=port,
            debug=False,
            use_debugger=False,
            threaded=False,
            processes=0,
            use_reloader=True)
else: # staging/production modes
    app.run(host='0.0.0.0',
            port=port,
# is a big security no-no
# Unless you have a firewall setup
#
# Something like /sbin/iptables -A INPUT -p tcp -i eth0 -s ! 71.236.239.43 --dport 5000 -j DROP
# should do the trick
#
# You'll probably have to firewall the main port and the
#
# For more info see: http://www.cyberciti.biz/faq/iptables-block-port/

#import logging
#logging.basicConfig(filename="/tmp/flask_gn_log", level=logging.INFO)
#
#_log = logging.getLogger("search")
#_ch = logging.StreamHandler()
#_log.addHandler(_ch)

import logging
#from themodule import TheHandlerYouWant
file_handler = logging.FileHandler("/tmp/flask_gn_log")
file_handler.setLevel(logging.DEBUG)
app.logger.addHandler(file_handler)

import logging_tree
logging_tree.printout()

app.run(host='0.0.0.0',
        use_debugger=False,
        threaded=True,
        use_reloader=True)
Exemple #3
0
# Run with gunicorn, see ./bin/genenetwork2 for an example
#
# Run standalone with
#
#   ./bin/genenetwork2 ./etc/default_settings.py -c run_gunicorn.py

# from flask import Flask
# application = Flask(__name__)

print "===> Starting up Gunicorn process"

from wqflask import app
from utility.startup_config import app_config

app_config()

@app.route("/gunicorn")
def hello():
    return "<h1 style='color:blue'>Hello There!</h1>"

if __name__ == "__main__":
    app.run(host='0.0.0.0')
Exemple #4
0
app.config['SECRET_KEY'] = os.urandom(24)

from utility.tools import WEBSERVER_MODE, get_setting_int

port = get_setting_int("SERVER_PORT")

logger.info("GN2 is running. Visit %shttp://localhost:%s/%s" %
            (BLUE, port, ENDC))

werkzeug_logger = logging.getLogger('werkzeug')

if WEBSERVER_MODE == 'DEBUG':
    app.run(host='0.0.0.0',
            port=port,
            debug=True,
            use_debugger=False,
            threaded=False,
            processes=0,
            use_reloader=True)
elif WEBSERVER_MODE == 'DEV':
    werkzeug_logger.setLevel(logging.WARNING)
    app.run(host='0.0.0.0',
            port=port,
            debug=False,
            use_debugger=False,
            threaded=False,
            processes=0,
            use_reloader=True)
else:  # staging/production modes
    app.run(host='0.0.0.0',
            port=port,
Exemple #5
0
# Something like /sbin/iptables -A INPUT -p tcp -i eth0 -s ! 71.236.239.43 --dport 5000 -j DROP
# should do the trick
#
# You'll probably have to firewall the main port and the
#
# For more info see: http://www.cyberciti.biz/faq/iptables-block-port/

#import logging
#logging.basicConfig(filename="/tmp/flask_gn_log", level=logging.INFO)
#
#_log = logging.getLogger("search")
#_ch = logging.StreamHandler()
#_log.addHandler(_ch)

print app.config

import logging
file_handler = logging.FileHandler(app.config['LOGFILE'])
file_handler.setLevel(logging.DEBUG)
app.logger.addHandler(file_handler)

import logging_tree
logging_tree.printout()

app.run(host='0.0.0.0',
        port=app.config['SERVER_PORT'],
        debug=True,
        use_debugger=True,
        threaded=True,
        use_reloader=True)
    This will make sure our mail program is running...or at least recently run...

    """
    error_msg = "Make sure your are running send_mail.py"
    send_mail_ping = Redis.get("send_mail:ping")
    print("send_mail_ping is:", send_mail_ping)
    if not send_mail_ping:
        sys.exit(error_msg)

    last_ping = time.time() - float(send_mail_ping)
    if not (0 < last_ping < 100):
        sys.exit(error_msg)


    print("send_mail.py seems to be running...")


if __name__ == '__main__':
    #create_user()



    check_send_mail_running()


    app.run(host='0.0.0.0',
        port=5002,
        use_debugger=True,
        threaded=True,
        use_reloader=True)