bin/dev-server
author Tero Marttila <terom@fixme.fi>
Sun, 14 Sep 2014 15:19:59 +0300
changeset 130 aaae02944832
parent 36 caabf287c75e
child 103 1a6a6957197d
permissions -rw-r--r--
bin/dev-server: listen on 0.0.0.0
#!/usr/bin/python

import wsgiref.simple_server
import werkzeug
from werkzeug.exceptions import NotFound

import pngtile.wsgi

# dispatch on URL
app = werkzeug.DispatcherMiddleware(pngtile.wsgi.application, {
    '/static':      werkzeug.SharedDataMiddleware(NotFound(), {
        '/':            'static',
    }),
})

def main (host='0.0.0.0', port=8000) :
    httpd = wsgiref.simple_server.make_server(host, port, app)

    print "Listening on %s:%d" % (host, port)

    httpd.serve_forever()

if __name__ == '__main__' :
    main()