2017-02-10 18:57:41 +01:00
|
|
|
from bottle import route, run,template,app,default_app
|
|
|
|
import logging
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG,)
|
|
|
|
log=logging.getLogger("rudemaps")
|
|
|
|
CONFIG={}
|
|
|
|
|
|
|
|
|
|
|
|
def load_config(config_file="config.json"):
|
|
|
|
global CONFIG
|
|
|
|
log.debug("loading configuration file")
|
|
|
|
with open(config_file, "r") as f:
|
|
|
|
try:
|
|
|
|
CONFIG = json.load(f)
|
|
|
|
log.debug("CONFIG:\n %s" % str(CONFIG))
|
|
|
|
except Exception, e:
|
|
|
|
log.warning("Problem loading config file %s :\n%s" % (config_file, e))
|
|
|
|
|
2017-02-08 21:35:33 +01:00
|
|
|
|
|
|
|
@route('/')
|
2017-02-08 22:46:49 +01:00
|
|
|
def root():
|
2017-02-10 18:57:41 +01:00
|
|
|
return template('map_template', item="prova bind")
|
2017-02-08 21:35:33 +01:00
|
|
|
|
2017-02-08 22:46:49 +01:00
|
|
|
@route('/<item>')
|
2017-02-08 22:26:41 +01:00
|
|
|
def myName(item):
|
2017-02-10 18:57:41 +01:00
|
|
|
return template('map_template', item=item)
|
2017-02-08 21:35:33 +01:00
|
|
|
|
2017-02-10 18:57:41 +01:00
|
|
|
load_config()
|
2017-02-08 21:35:33 +01:00
|
|
|
|
2017-02-10 18:57:41 +01:00
|
|
|
if __name__=='__main__':
|
|
|
|
#DEVEL SERVER
|
|
|
|
from bottle import debug
|
|
|
|
debug(True)
|
|
|
|
run(host='localhost', port=9093,reloader=True)
|
|
|
|
else:
|
|
|
|
#WSGI
|
|
|
|
os.chdir(os.path.dirname(__file__))
|
|
|
|
application = default_app()
|