Beispiel #1
0
def main():
    # Start the tornado ioloop application
    ioloop = IOLoop.instance()

    if len(sys.argv) > 1:
        filename = sys.argv[1]
        with open(filename, 'r') as f:
            recipe_yaml = f.read()
    else:
        recipe_yaml = ''

    recipe = ModuleCollection.fromYAML(recipe_yaml)

    print(recipe)

    # Instantiate the domain model
    fred = Person(name='Fred', age=42)

    # Create a web app serving the view with the domain model added to its
    # context.
    app = WebApp(template=template, context={'recipe': recipe})
    app.listen(8000)

    # Start serving the web app on port 8000.
    #
    # Point your web browser to http://localhost:8000/ to connect to this jigna
    # web app. Any operation performed on the client directly update the
    # model attributes on the server.
    print('Serving on port 8000...')
    ioloop.start()
def main():
    os.environ[
        'DJANGO_SETTINGS_MODULE'] = 'clusterUI.settings'  # path to your settings module
    application = get_wsgi_application()

    django_app = tornado.wsgi.WSGIContainer(application)
    tornado_app = JignaWebApp(
        handlers=[
            (r'/static/(.*)', tornado.web.StaticFileHandler, {
                'path': PYME.resources.get_web_static_dir()
            }),
            #(r'/media/(.*)', tornado.web.StaticFileHandler, {'path': MEDIA_URL}),
            #(r'/recipe_editor/(.*)', tornado.web.StaticFileHandler, {'path': os.path.dirname(html_recipe_editor.__file__)}),
            (r'.*', tornado.web.FallbackHandler, dict(fallback=django_app)),
        ],
        template=html_recipe_editor.template,
        context={'recipe': ModuleCollection.fromYAML(rec_text)})
    #server = tornado.httpserver.HTTPServer(tornado_app)

    http_server = tornado.httpserver.HTTPServer(tornado_app)
    http_server.listen(8889)
    tornado.ioloop.IOLoop.instance().start()