Skip to content

Instantly share code, notes, and snippets.

@allanlei
Created January 17, 2012 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allanlei/1627883 to your computer and use it in GitHub Desktop.
Save allanlei/1627883 to your computer and use it in GitHub Desktop.
Simple staticfile server for development using fapws
#!/usr/bin/env python
'''
pip install fapws3
python staticfile-server.py
'''
import fapws._evwsgi as evwsgi
from fapws import base
from fapws.contrib import views
from fapws.contrib import zip, log
def start():
evwsgi.start('0.0.0.0', '80')
evwsgi.set_base_module(base)
evwsgi.wsgi_cb(('/css', log.Log()(zip.Gzip()(views.Staticfile('static/css', maxage=2629000)))))
evwsgi.wsgi_cb(('/images', log.Log()(views.Staticfile('static/images', maxage=2629000))))
evwsgi.wsgi_cb(('/js', log.Log()(zip.Gzip()(views.Staticfile('static/js', maxage=2629000)))))
evwsgi.set_debug(0)
evwsgi.run()
if __name__ == '__main__':
start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment