def main(): #Find a way to check if dev server. if get_default_version_hostname() == 'localhost:8080': debug(True) else: @error(500) def Error500(code): logging.error('There was an internal server error') message = 'Internal Server Error' return template('templates/simple.tpl', body=message) run_wsgi_app(bottle.default_app())
if agency: if type(agency) is type: agency = agency() agencies[agency.name] = agency if agency.routes: return agency return None @bottle.route('/<agency>/times/<orig>/<dest>') def times_handler(agency, orig, dest): agency = get_agency(agency) if agency: return get_times_response(agency, orig, dest) raise bottle.HTTPError(404) @bottle.route('/<agency>/stops') @bottle.route('/<agency>/stops/<route>') def stops_handler(agency, route=None): agency = get_agency(agency) if agency and not route: return '\r\n'.join(agency.stops.keys() + agency.station_replacements.keys()) raise bottle.HTTPError(404) bottle.debug(True) if __name__ == "__main__": bottle.run(host='localhost', port=8080) else: bottle.run(server='gae') application = bottle.app()
#!/usr/bin/python # -*- coding: utf-8 -*- from module import app from lib.bottle import run,static_file,debug,request from setting import STATIC_PATH @app.route('/static/<filename:path>') def static(filename): return static_file(filename,STATIC_PATH) if __name__ == '__main__': debug(True) run(app, host="0.0.0.0",port=9090,reloader=True)
def main(): debug(True) app = bottle.app() run_wsgi_app(app)