From 54ba68cb0acae5978a33dde39603f58e687953fa Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 17 Sep 2013 11:55:14 +0530 Subject: [PATCH 1/3] Add static middleware --- webnotes/app.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/webnotes/app.py b/webnotes/app.py index 14b7c1f7b4..e3b934793f 100644 --- a/webnotes/app.py +++ b/webnotes/app.py @@ -4,6 +4,7 @@ sys.path.extend(["..", "../app", "../lib"]) from werkzeug.wrappers import Request, Response from werkzeug.local import LocalManager +from werkzeug.wsgi import SharedDataMiddleware import mimetypes import webnotes @@ -37,11 +38,16 @@ def application(request): application = local_manager.make_middleware(application) + +application = SharedDataMiddleware(application, { + '/': os.path.join(os.path.dirname(__file__), "..", "..", "public") +}) + if __name__ == '__main__': import sys from werkzeug.serving import run_simple run_simple('localhost', 8000, application, use_reloader=True, - use_debugger=True, use_evalex=True, static_files = { - "/": os.path.join(os.path.dirname(__file__), "..", "..", "public") - }) \ No newline at end of file + use_debugger=True, use_evalex=True) + + From dcf738f76b0a2aec4f74e2a7cd0e626b93f575de Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 17 Sep 2013 11:55:30 +0530 Subject: [PATCH 2/3] remove print statement --- webnotes/handler.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/webnotes/handler.py b/webnotes/handler.py index d847a7c21f..6cf15eab7d 100755 --- a/webnotes/handler.py +++ b/webnotes/handler.py @@ -156,8 +156,6 @@ def print_json(): import json - print webnotes.response - print_zip(json.dumps(webnotes.local.response, default=json_handler, separators=(',',':'))) def print_csv(): From 63e64701b8bcf161ddf441fe2f7e5b1175d61b10 Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 17 Sep 2013 11:57:40 +0530 Subject: [PATCH 3/3] tabs|spaces --- webnotes/app.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webnotes/app.py b/webnotes/app.py index e3b934793f..b114385c98 100644 --- a/webnotes/app.py +++ b/webnotes/app.py @@ -40,7 +40,7 @@ application = local_manager.make_middleware(application) application = SharedDataMiddleware(application, { - '/': os.path.join(os.path.dirname(__file__), "..", "..", "public") + '/': os.path.join(os.path.dirname(__file__), "..", "..", "public") }) if __name__ == '__main__': @@ -50,4 +50,3 @@ if __name__ == '__main__': run_simple('localhost', 8000, application, use_reloader=True, use_debugger=True, use_evalex=True) -