| t | Here are some articles on flask: | t | |
| <p> | | |
| How to install flash/gunicorn on Ubuntu 18.04 and use nginx as a reverse proxy: | | |
| <ul><li><a href="https://linoxide.com/linux-how-to/install-flask-python-ubuntu/">https://linoxide.com/linux-how-to/install-flask-python-ubuntu/</a> | | |
| <ul><li>also has info on interacting with the firewall and setting up a systemd unit file | | |
| </ul> | | |
| </ul> | | |
| <p> | | |
| <h1><a name="Notes">Notes</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/FlaskResearch?action=edit§ion=Notes">edit section</a>]</font></span> | | |
| </h1> | | |
| flask has a built-in web server, but it does not scale. | | |
| <p> | | |
| However a flask app IS a WSGI-compatible app. | | |
| <p> | | |
| See <a href="https://flask.palletsprojects.com/en/1.1.x/deploying/mod_wsgi/">https://flask.palletsprojects.com/en/1.1.x/deploying/mod_wsgi/</a> | | |
| for how to install a flash application with Apache and mod_wsgi | | |
| (Apache is what I have on birdcloud.org) | | |
| <p> | | |
| See <a href="https://flask.palletsprojects.com/en/1.1.x/deploying/#deployment">https://flask.palletsprojects.com/en/1.1.x/deploying/#deployment</a> | | |
| for other deployment options. | | |
| <p> | | |
| <h1><a name="Using_mod_wsgi_with_apache">Using mod_wsgi with apache</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/FlaskResearch?action=edit§ion=Using_mod_wsgi_with_apache">edit section</a>]</font></span> | | |
| </h1> | | |
| See <a href="https://www.howtoforge.com/tutorial/how-to-run-python-scripts-with-apache-and-mod_wsgi-on-ubuntu-18-04/">https://www.howtoforge.com/tutorial/how-to-run-python-scripts-with-apache-and-mod_wsgi-on-ubuntu-18-04/</a> | | |
| <p> | | |
| Here's what I did on birdcloud: | | |
| <ul><li>$ sudo apt-get install libapache2-mod-wsgi -y | | |
| <li>$ vi /var/www/owncloud/wsgy.py (see script for contents) | | |
| <li>$ chown www-data:www-data /var/www/owncloud/wsgy.py | | |
| <li>$ chmod 755 /var/www/owncloud/wsgy.py | | |
| <li>$ echo "WSGIScriptAlias /wsgi /var/www/owncloud/wsgy.py" >/etc/apache2/conf-available/wsgi.conf | | |
| <li>$ a2enconf wsgi | | |
| <ul><li>(only need to run this once, to enable wsgi in apache configuration) | | |
| </ul><li>$ systemctl restart apache2 | | |
| <ul><li>(need to run this every time you change the wsgi.conf file) | | |
| </ul><li>$ browser <a href="https://birdcloud.org/wsgi">https://birdcloud.org/wsgi</a> | | |
| </ul> | | |
| <p> | | |
| I made another script /var/www/owncloud/test_wsgi.py that mirrors | | |
| the actions of /var/lib/cgi-bin/test_cgi.py | | |
| <p> | | |
| I did this in order to test responsiveness of cgi vs wsgi. | | |
| <ul><li>test.cgi loads in about 40 milliseconds | | |
| <li>test_wsgi loads in about 9 milliseconds | | |
| and that's with wsgi.mod_wsgi.script_reloading=1 | | |
| </ul> | | |
| <p> | | |
| <h2><a name="putting_mod_wsgi_into_daemon_mode_to_avoid_app_reload">putting mod_wsgi into daemon mode to avoid app reload</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/FlaskResearch?action=edit§ion=putting_mod_wsgi_into_daemon_mode_to_avoid_app_reload">edit section</a>]</font></span> | | |
| </h2> | | |
| See this information: | | |
| <p> | | |
| <a href="https://stackoverflow.com/questions/766601/mod-wsgi-force-reload-modules">https://stackoverflow.com/questions/766601/mod-wsgi-force-reload-modules</a> | | |
| <p> | | |
| <a href="https://modwsgi.readthedocs.io/en/develop/user-guides/reloading-source-code.html">https://modwsgi.readthedocs.io/en/develop/user-guides/reloading-source-code.html</a> | | |
| <p> | | |