tornado.options.parse_command_line()
# Initialize application
- app = Application(configfile="webapp.conf")
+ app = Application("webapp.conf")
app.listen(tornado.options.options.port)
# Launch IOLoop
BASEDIR = os.path.join(os.path.dirname(__file__), "..")
class Application(tornado.web.Application):
- def __init__(self, **kwargs):
- self.__backend = None
+ def __init__(self, config, **kwargs):
+ # Initialize backend
+ self.backend = backend.Backend(config)
settings = dict(
debug = tornado.options.options.debug,
logging.info("Successfully initialied application")
- @property
- def backend(self):
- if self.__backend is None:
- configfile = self.settings.get("configfile", None)
- if not configfile:
- raise RuntimeException("Could not find configuration file")
-
- self.__backend = backend.Backend(configfile=configfile,
- debug=self.settings.get("debug", False))
-
- return self.__backend
-
def format_month_name(self, handler, month):
_ = handler.locale.translate