Exemplo n.º 1
0
"""
    Biothings API
    
    Support running biothings.web as a module

    >> python -m biothings.web
    >> python -m biothings.web --dir=~/mygene.info/src
    >> python -m biothings.web --dir=~/mygene.info/src --conf=config_web
    >> python -m biothings.web --conf=biothings.web.settings.default

    See more supported parameters in biothings.web.launcher.

"""

from biothings.web.launcher import main

main()
Exemplo n.º 2
0
"""
    https://pending.biothings.io/
    https://biothings.ncats.io/
"""

from biothings.web.launcher import main
from web.handlers import EXTRA_HANDLERS

if __name__ == "__main__":
    main(EXTRA_HANDLERS, {"static_path": "static"})
Exemplo n.º 3
0
from aiocron import crontab
from biothings.web.launcher import main

from discovery.handlers import HANDLERS, TemplateHandler
from discovery.notify import update_n3c_routine
from discovery.utils.backup import daily_backup_routine


def routine():
    update_n3c_routine()
    daily_backup_routine()


def run_routine():
    thread = Thread(target=routine, daemon=True)
    thread.start()


if __name__ == '__main__':

    crontab('0 0 * * *', func=run_routine,
            start=True)  # run daily at mid-night
    main(HANDLERS, {
        "default_handler_class": TemplateHandler,
        "default_handler_args": {
            "filename": "404.html",
            "status_code": 404
        }
    },
         use_curl=True)
Exemplo n.º 4
0
from tornado.web import StaticFileHandler, RedirectHandler

from biothings.web.launcher import main

if __name__ == "__main__":
    main([
        # override default frontpage
        (r"/", RedirectHandler, {
            "url": "/standalone",
            "permanent": False
        }),
        (r"/demo/?()", StaticFileHandler, {
            "path": "docs/demo",
            "default_filename": "index.html"
        }),
        (r"/standalone/?()", StaticFileHandler, {
            "path": "docs/standalone",
            "default_filename": "index.html"
        }),
    ])
Exemplo n.º 5
0
define("webapp", default=False, help="Run server with frontend webapp.")


class WebAppHandler(RequestHandler):
    def get(self):
        self.render(os.path.join(ASSETS_PATH, 'index.html'))


class NotFoundHandler(RequestHandler):
    def get(self):
        self.render(os.path.join(ASSETS_PATH, "404.html"))


if __name__ == "__main__":
    options.parse_command_line()
    # Run with webapp
    if options.webapp:
        main([(r"/", WebAppHandler),
              (r"/css/(.*)", "tornado.web.StaticFileHandler", {
                  "path": os.path.join(ASSETS_PATH, "css")
              }),
              (r"/js/(.*)", "tornado.web.StaticFileHandler", {
                  "path": os.path.join(ASSETS_PATH, "js")
              }),
              (r"/img/(.*)", "tornado.web.StaticFileHandler", {
                  "path": os.path.join(ASSETS_PATH, "img")
              }), (r"/.*", NotFoundHandler)])
    else:
        # Run only backend
        main()
Exemplo n.º 6
0
from biothings.web.launcher import main
from tornado.web import RedirectHandler

from web.handlers import ApiViewHandler, MainHandler, SpecialHandler
from web.handlers.genomics import routes as genomics_routes

if __name__ == '__main__':
    main([
        *genomics_routes, (r"/", MainHandler),
        (r"/v1/(.*)", RedirectHandler, {
            "url": "/covid19/{0}"
        }), (r"/try-by-doctype/resources/?", SpecialHandler),
        (r"/try/.+", ApiViewHandler), (r"/try/.+/.+", ApiViewHandler)
    ])  # additionals