diff wikked/commands/web.py @ 174:298b9f5ccdac

Common code for fallback when Bcrypt is not available. Quick workaround (changing current working directory) for correctly initializing the Flask application. WSGI helper to easily bootstrap a website for production.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 28 Jan 2014 20:34:11 -0800
parents 8701790360e0
children a971deb123d7
line wrap: on
line diff
--- a/wikked/commands/web.py	Tue Jan 28 08:17:39 2014 -0800
+++ b/wikked/commands/web.py	Tue Jan 28 20:34:11 2014 -0800
@@ -24,7 +24,13 @@
                 action='store_true')
 
     def run(self, ctx):
+        # Change working directory because the Flask app can currently
+        # only initialize itself relative to that...
+        # TODO: make the Flask initialization more clever.
+        os.chdir(ctx.params.root)
+
         from wikked.web import app
+        app.wiki_params = ctx.params
 
         if bool(app.config.get('UPDATE_WIKI_ON_START')):
             ctx.wiki.update()
@@ -34,7 +40,6 @@
         if ctx.args.debug:
             app.config['DEBUG'] = True
 
-        app.wiki_params = ctx.params
         app.run(
                 host=ctx.args.host,
                 port=ctx.args.port,