Skip to content
Snippets Groups Projects
Commit 8517afbd authored by jkerdreu's avatar jkerdreu
Browse files

Now you can launch the dashboard like any other xaal apps.. python -m xaal.dashboard

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@1909 b32b6428-25c9-4566-ad07-03861ab6144f
parent 5aa2bb03
No related branches found
No related tags found
No related merge requests found
from gevent import monkey; monkey.patch_all() from gevent import monkey; monkey.patch_all()
from bottle import default_app,debug,get,redirect,static_file from bottle import default_app,debug,get,redirect,static_file,TEMPLATE_PATH
from gevent.pywsgi import WSGIServer from gevent.pywsgi import WSGIServer
from geventwebsocket.handler import WebSocketHandler from geventwebsocket.handler import WebSocketHandler
from pages import default_pages from .pages import default_pages
from core import xaal_core from .core import xaal_core
from core import sio from .core import sio
import os
HOME = os.path.dirname(__file__)
@get('/static/<filename:path>') @get('/static/<filename:path>')
def send_static(filename): def send_static(filename):
return static_file(filename, root='./static/') root = os.path.join(HOME,'static')
return static_file(filename, root=root)
@get('/') @get('/')
def goto_home(): def goto_home():
redirect('/test_grid') redirect('/test_grid')
def foo():
from bottle import request
return "Foo [%s]" % request.environ['REMOTE_ADDR']
def run(): def run():
""" start the xAAL stack & launch the HTTP stuff""" """ start the xAAL stack & launch the HTTP stuff"""
# add the default template directory to the bottle search path
root = os.path.join(HOME,'templates')
TEMPLATE_PATH.append(root)
xaal_core.setup() xaal_core.setup()
# debug disable template cache & enable error reporting # debug disable template cache & enable error reporting
debug(True) debug(True)
bottle_app = default_app() bottle_app = default_app()
app = sio.setup(bottle_app) app = sio.setup(bottle_app)
bottle_app.route('/foo1', ['GET', 'POST'], foo)
server = WSGIServer(("", 9090), app, handler_class=WebSocketHandler) server = WSGIServer(("", 9090), app, handler_class=WebSocketHandler)
server.serve_forever() server.serve_forever()
......
import bottle
# add the default template directory to the bottle search path
bottle.TEMPLATE_PATH.append('./templates/')
from bottle import route from bottle import route
from bottle import mako_view as view from bottle import mako_view as view
from core import xaal_core from xaal.dashboard.core import xaal_core
#from core import xaal_core
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment