Commits

Joe Walker  committed 946f15e

make mobwrite_web use dev mode properly

  • Participants
  • Parent commits 592f13a

Comments (0)

Files changed (1)

File backend/python/bespin/mobwrite/mobwrite_web.py

         request = Request(environ)
         response = Response()
         try:
-          answer = self.handleRequest(request.body)
-          response.body = answer
-          response.content_type = "application/mobwrite"
+            answer = self.handleRequest(request.body)
+            response.body = answer
+            response.content_type = "application/mobwrite"
         except Exception, e:
-          log.exception("error in request handling")
-          response.status = "500 Internal Server Error"
-          response.body = str(e)
+            log.exception("error in request handling")
+            response.status = "500 Internal Server Error"
+            response.body = str(e)
         return response(environ, start_response)
-    
+
 def start_server(args=None):
-  if args is None:
-    args = sys.argv[1:]
+    if args is None:
+        args = sys.argv[1:]
 
-  if args:
-    mode = args.pop(0)
-  else:
-    mode = "dev"
+    if args:
+        mode = args.pop(0)
+    else:
+        mode = "dev"
 
-  print("Bespin mobwrite worker (mode=" + mode + ")")  
-  config.set_profile(mode)
+    print("Bespin mobwrite worker (mode=" + mode + ")")  
+    config.set_profile(mode)
 
-  if args:
-    config.load_pyconfig(args.pop(0))
+    if args:
+        config.load_pyconfig(args.pop(0))
 
-  config.activate_profile()
-  
-  app = WSGIMobWrite()
-  app = db_middleware(app)
+    if mode == "dev":
+        config.load_pyconfig("devconfig.py")
 
-  serve(app, config.c.mobwrite_server_address, config.c.mobwrite_server_port, use_threadpool=True)
+    config.activate_profile()
+
+    app = WSGIMobWrite()
+    app = db_middleware(app)
+
+    serve(app, config.c.mobwrite_server_address, config.c.mobwrite_server_port, use_threadpool=True)