equal
deleted
inserted
replaced
1 #!/usr/bin/python |
|
2 |
|
3 import flup.server.fcgi |
|
4 |
|
5 import memcache |
|
6 |
|
7 def run_fastcgi (app, bind=None) : |
|
8 # create WSGIServer |
|
9 server = flup.server.fcgi.WSGIServer(app, |
|
10 # try to supress threading |
|
11 multithreaded=False, |
|
12 multiprocess=False, |
|
13 multiplexed=False, |
|
14 |
|
15 # specify the bind() address |
|
16 bindAddress=bind, |
|
17 |
|
18 # leave as defaults for now |
|
19 umask=None, |
|
20 |
|
21 # XXX: non-debug mode? |
|
22 debug=True, |
|
23 ) |
|
24 |
|
25 # run... threads :( |
|
26 server.run() |
|
27 |
|
28 def main (bind=None) : |
|
29 """ |
|
30 Run as a non-threaded single-process non-multiplexed FastCGI server |
|
31 """ |
|
32 |
|
33 # open cache |
|
34 cache = memcache.Client(['localhost:11211']) |
|
35 |
|
36 # build app |
|
37 app = pngtile.wsgi.WSGIApplication(cache) |
|
38 |
|
39 # server |
|
40 run_fastcgi(app, bind) |
|
41 |
|
42 if __name__ == '__main__' : |
|
43 import pngtile.wsgi |
|
44 |
|
45 main() |
|
46 |
|