WSGI - kstrack-grose/Git-Project GitHub Wiki

#WSGI WSGI stands for Web Server Gateway Interface "The WSGI interface has two sides: the "server" or "gateway" side, and the "application" or "framework" side. The server side invokes a callable object that is provided by the application side. The specifics of how that object is provided are up to the server or gateway. It is assumed that some servers or gateways will require an application's deployer to write a short script to create an instance of the server or gateway, and supply it with the application object. Other servers and gateways may use configuration files or other mechanisms to specify where an application object should be imported from, or otherwise obtained."

More info can be found here: http://legacy.python.org/dev/peps/pep-3333/ and http://en.wikipedia.org/wiki/Wsgi and http://lucumr.pocoo.org/2007/5/21/getting-started-with-wsgi/

##Here are the instructions for getting WSGI

Do everything in root!

apt-get install aptitude

aptitude install libapache2-mod-wsgi

service apache2 restart

There you go, you should have this and be able to see it if you cd /etc/apache2/mods-available

##Making WSGI Work After install and apache2 restart, type a2enmod wsgi to activate wsgi on this machine

then go to /var/www and mkdir for where your wsgi files will live

CD into that file and add a .wsgi file with your test code inside it

Open a new window and cd into /etc/apache2 and nano into the apache2.conf file (this is the main configuration file)

add WSGIScriptAlias /myapp /absolute/path/toyourwsgifile.wsgi to the bottom of the configuration file (note that this takes two arguments /myapp is an alias that you type into the browser to access this file and the second argument is simply the exact file path to the wsgi file)

Also add
(add a little arrow going left)Directory /usr/local/www/wsgi-scripts(add a little arrow going right)
Order allow,deny
Allow from all
(add a little arrow going left)/Directory(add little arrow going right)

Then save that and restart apache2 with service apache2 restart

Now you need to create a directory within wsgi files that apache2 will write to. Then change the owner to to www-data (this is the user apache2 runs as). The command to change the own is chown and operates like chmod just without the numbers or u+a...

Then add your test code: good test code and help can be found at

http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide

[This tutorial] (http://webpython.codepoint.net/wsgi_tutorial) provides a simple, low level explanation of how WSGI functions.

Here is WSGI integration with Django:https://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

##OH GOD OH GOD
https://wiki.archlinux.org/index.php/mod_wsgi

Yo! https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIScriptAlias

Things to try out: https://github.com/psi-gh/uploadfile/blob/master/sendfile.wsgi


This code may be helpful to get the post content submitted from forms.
[List of things] (http://modwsgi.readthedocs.org/en/latest/configuration-directives/index.html) that WSGI can do.
[file wrapping] (http://code.google.com/p/modwsgi/wiki/FileWrapperExtension) looks super useful.

wgsi tutorial: http://archimedeanco.com/wsgi-tutorial/

wsgi xsendfile: http://pythonhosted.org/xsendfile/howto.html https://github.com/2degrees/wsgi-xsendfile

⚠️ **GitHub.com Fallback** ⚠️