<div dir="ltr"><font face="arial, helvetica, sans-serif">I just announced the Gerrit Patch Uploader - <a href="https://tools.wmflabs.org/gerrit-patch-uploader/">https://tools.wmflabs.org/gerrit-patch-uploader/</a> - on wikitech-l. This is meant for the Tool Labs crowd as a note on how I implemented it.</font><div>

<font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">First of all, I'm using the new web (lighttpd) scheme. To run a Flask application, you need to setup ~/.lighttpd.conf and an fcgi file. The lighttpd conf is available at [1], while the app.fcgi is at [2].<br>

</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">For the lighttpd conf, <span style="color:rgb(51,51,51);font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre">debug.log-request-handling = "enable" is really useful - it tells you how lighttpd is handling your request. There are some ohter debug options: [3]</span></font></div>

<div><span style="color:rgb(51,51,51);font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="color:rgb(51,51,51);font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre"><font face="arial, helvetica, sans-serif">The app.fcgi activates it's own request logging, which helps to understand how Flask is handling the request.</font></span></div>

<div><span style="color:rgb(51,51,51);font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="color:rgb(51,51,51);font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre"><font face="arial, helvetica, sans-serif">The user identification is handled by OAuth - not really meant for this, but it works, thanks to the 'userinfo' api function. I have published the Flask blueprint for this seperately as flask-mwoauth [4]. Please check demo.py [5] for info on how to use it. </font></span></div>

<div><span style="color:rgb(51,51,51);font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><font color="#333333" face="arial, helvetica, sans-serif"><span style="font-size:12px;line-height:17.984375px;white-space:pre">If you have any questions on running a Flask app over fcgi on TL, or using oauth-based identification, please let me know.</span></font></div>

<div><span style="color:rgb(51,51,51);font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="color:rgb(51,51,51);font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre"><font face="arial, helvetica, sans-serif">Merlijn</font></span></div>

<div><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre"><br></span></div><div><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre">[1]</span> <a href="https://github.com/valhallasw/gerrit-patch-uploader/blob/master/lighttpd.conf">https://github.com/valhallasw/gerrit-patch-uploader/blob/master/lighttpd.conf</a></div>

<div><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre">[2]</span> <a href="https://github.com/valhallasw/gerrit-patch-uploader/blob/master/app.fcgi">https://github.com/valhallasw/gerrit-patch-uploader/blob/master/app.fcgi</a></div>

<div><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12.222222328186035px;line-height:17.98611068725586px;white-space:pre">[3] </span><a href="http://redmine.lighttpd.net/projects/1/wiki/DebugVariables">http://redmine.lighttpd.net/projects/1/wiki/DebugVariables</a></div>

<div>[4] <a href="https://github.com/valhallasw/flask-mwoauth">https://github.com/valhallasw/flask-mwoauth</a></div><div>[5] <a href="https://github.com/valhallasw/flask-mwoauth/blob/master/demo.py">https://github.com/valhallasw/flask-mwoauth/blob/master/demo.py</a></div>

</div>