File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import os
1010import imp
1111from wsgiref .simple_server import make_server
12+ from werkzeug .wsgi import SharedDataMiddleware
1213
1314import sae .core
1415
15- def main ():
16+ def main (app_root ):
1617
1718 try :
1819 index = imp .load_source ('index' , 'index.wsgi' )
@@ -28,7 +29,12 @@ def main():
2829 print "application is not a callable"
2930 sys .exit (- 1 )
3031
31- server = make_server ("" , 8080 , index .application )
32+ app = SharedDataMiddleware (index .application ,
33+ { '/static' : os .path .join (app_root , 'static' ),
34+ '/media' : os .path .join (app_root , 'media' ),
35+ '/favicon.ico' : os .path .join (app_root , 'favicon.ico' ),
36+ })
37+ server = make_server ("" , 8080 , app )
3238 print "Start development server on http://localhost:8080/"
3339 try :
3440 server .serve_forever ()
@@ -46,4 +52,4 @@ def main():
4652 except :
4753 print 'MySQL config not found: app.py'
4854
49- main ()
55+ main (cwd )
Original file line number Diff line number Diff line change 88 author_email = "chenzheng2@staff.sina.com.cn" ,
99 description = ("SAE Python development server" ),
1010 install_requires = [
11+ 'Werkzeug' ,
1112 #'Django==1.2.7',
1213 #'bottle==0.9.6',
1314 #'tornado==2.1.1',
You can’t perform that action at this time.
0 commit comments