# HG changeset patch # User Matt Johnston # Date 1433576043 -28800 # Node ID a335760ad4471aeb925ec56ba918a9af76c401b9 # Parent 0baa57b6d9ca105e9cec4e2fd374e9c4ed8cc64d uwsgi bits diff -r 0baa57b6d9ca -r a335760ad447 web/requirements.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/requirements.txt Sat Jun 06 15:34:03 2015 +0800 @@ -0,0 +1,11 @@ +argparse==1.2.1 +gevent==1.0.2 +greenlet==0.4.7 + +# sha256: nkIlLxfR3YnuMXReDE--WIYsJRR-sO9SlcnNm8tOosE +lockfile==0.10.2 + +peep==2.4.1 +python-rrdtool==1.4.7 +uWSGI==2.0.10 +wsgiref==0.1.2 diff -r 0baa57b6d9ca -r a335760ad447 web/templog-uwsgi.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/templog-uwsgi.ini Sat Jun 06 15:34:03 2015 +0800 @@ -0,0 +1,15 @@ +[uwsgi] + +# run with "/path/to/venv/bin/uwsgi --chdir /path/to/web /path/to/web/templog.uwsgi" +# tested with Apache mod_proxy_uwsgi and +# ProxyPass /~matt/t2 uwsgi://127.0.0.1:9090/ + +# future: apache > 2.4.9 could use "socket=uwsgi.sock" and then apache config of +# ProxyPass /templog unix:/path/to/web/uwsgi.sock|uwsgi:// +socket=127.0.0.1:9090 + +wsgi-file=templog.uwsgi +gevent=100 + +# for client certificates. default limit is 4096, not sufficient +buffer-size=20000 diff -r 0baa57b6d9ca -r a335760ad447 web/templog.py --- a/web/templog.py Wed May 27 23:45:03 2015 +0800 +++ b/web/templog.py Sat Jun 06 15:34:03 2015 +0800 @@ -159,12 +159,18 @@ #var_lookup = environ['mod_ssl.var_lookup'] #return var_lookup("SSL_SERVER_I_DN_O") +@route('/wait') +def wait(): + response.set_header('Content-Type', 'text/plain') + yield 'done' + @bottle.get('/') def javascripts(filename): response.set_header('Cache-Control', "public, max-age=1296000") return bottle.static_file(filename, root='static') def main(): + """ for standalone testing """ #bottle.debug(True) #bottle.run(reloader=True) bottle.run(server='cgi', reloader=True) diff -r 0baa57b6d9ca -r a335760ad447 web/templog.uwsgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/templog.uwsgi Sat Jun 06 15:34:03 2015 +0800 @@ -0,0 +1,20 @@ +# see templog-uwsgi.ini for arguments + +from gevent import monkey; monkey.patch_all() + +import os +import sys +import trace +# Change working directory so relative paths (and template lookup) work again +thisdir = os.path.dirname(__file__) +if not thisdir: + thisdir="." +os.chdir(thisdir) +os.environ['LD_LIBRARY_PATH'] = '/home/matt/templog/web' + +# for some reason local imports don't work... +sys.path.append(thisdir) + +import bottle +import templog +application = bottle.default_app()