コード例 #1
0
ファイル: website.py プロジェクト: Ronit12/lmfdb
def main():
    info("main: ...done.")
    from lmfdb.utils.config import Configuration
    flask_options = Configuration().get_flask()

    if "profiler" in flask_options and flask_options["profiler"]:
        print "Profiling!"
        from werkzeug.contrib.profiler import ProfilerMiddleware
        app.wsgi_app = ProfilerMiddleware(app.wsgi_app,
                                          restrictions=[30],
                                          sort_by=('cumulative', 'time',
                                                   'calls'))
        del flask_options["profiler"]

    lmfdb.app.set_running()
    app.run(**flask_options)
コード例 #2
0
def main():
    info("main: ...done.")
    from lmfdb.utils.config import Configuration

    flask_options = Configuration().get_flask()

    if "profiler" in flask_options and flask_options["profiler"]:
        info("Profiling!")
        from werkzeug.contrib.profiler import ProfilerMiddleware

        app.wsgi_app = ProfilerMiddleware(app.wsgi_app,
                                          restrictions=[30],
                                          sort_by=("cumulative", "time",
                                                   "calls"))
        del flask_options["profiler"]

    if "COCALC_PROJECT_ID" in os.environ:
        from lmfdb.utils.cocalcwrap import CocalcWrap
        # we must accept external connections
        flask_options["host"] = "0.0.0.0"
        app.wsgi_app = CocalcWrap(app.wsgi_app)
        stars = "\n" + "*" * 80
        info(stars + "\n\033[1mCocalc\033[0m environment detected!\n" +
             "Visit" + "\n  \033[1m https://cocalc.com" +
             app.wsgi_app.app_root + " \033[0m" +
             "\nto access this LMFDB instance" + stars)

    set_running()
    app.run(**flask_options)
コード例 #3
0
ファイル: website.py プロジェクト: everthemore/seminars
def main():
    info("main: ...done.")
    from lmfdb.utils.config import Configuration

    flask_options = Configuration().get_flask()

    if "profiler" in flask_options and flask_options["profiler"]:
        info("Profiling!")
        from werkzeug.middleware.profiler import ProfilerMiddleware

        app.wsgi_app = ProfilerMiddleware(app.wsgi_app,
                                          restrictions=[30],
                                          sort_by=("cumulative", "time",
                                                   "calls"))
        del flask_options["profiler"]
    #/from werkzeug.middleware.profiler import ProfilerMiddleware
    #/app.wsgi_app = ProfilerMiddleware(
    #/    app.wsgi_app, restrictions=[30], sort_by=("cumulative", "time", "calls")
    #/    )

    set_running()
    app.run(**flask_options)