Permalink
Browse files

static makes that easier

  • Loading branch information...
1 parent f619566 commit b3cfdd99297b015e5999afd90465b4e595103325 @kennethreitz committed Jan 15, 2012
Showing with 5 additions and 24 deletions.
  1. +5 −24 goldenarch/core.py
View
@@ -8,25 +8,15 @@
"""
import os
+import sys
-from werkzeug.wrappers import Request
-from werkzeug.wsgi import SharedDataMiddleware
-
+import static
PORT = os.environ.get('PORT', 8000)
-STATIC_DIR = os.environ.get('STATIC_DIR', '.')
-
-class GoldenArch(object):
- def __init__(self):
- super(GoldenArch, self).__init__()
+STATIC_DIR = sys.argv[1]
- def wsgi_app(self, environ, start_response):
- request = Request(environ)
- response = self.dispatch_request(request)
- return response(environ, start_response)
- def __call__(self, environ, start_response):
- return self.wsgi_app(environ, start_response)
+app = static.Cling(STATIC_DIR)
def cli():
@@ -38,18 +28,9 @@ def cli():
'-w 16 -k gevent -t 2 '
'--name goldenarch'
).format(port=PORT)
- os.system(cmd)
+ os.system(cmd)
-app = GoldenArch()
-
-app.wsgi_app = SharedDataMiddleware(
- app.wsgi_app,
- {
- '/': os.path.join(STATIC_DIR)
- }
-)
-
if __name__ == '__main__':
cli()

0 comments on commit b3cfdd9

Please sign in to comment.