Size: 705
Comment:
|
← Revision 9 as of 2025-01-16 14:00:36 ⇥
Size: 2648
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
<<TableOfContents(2)>> ## page was renamed from modwsgi |
|
Line 3: | Line 5: |
http://code.google.com/p/modwsgi/ |
* http://code.google.com/p/modwsgi/ * https://github.com/GrahamDumpleton/mod_wsgi |
Line 7: | Line 9: |
* apt-get install libapache2-mod-wsgi * service apache2 restart |
{{{#!highlight sh apt-get install libapache2-mod-wsgi service apache2 restart }}} |
Line 26: | Line 30: |
{{{ | {{{#!highlight sh |
Line 29: | Line 33: |
== Slackware 14 installation == {{{#!highlight sh wget http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-3.4.tar.gz&can=1&q= cp mod_wsgi-3.4.tar.gz /tmp cd /tmp tar xvzf mod_wsgi-3.4.tar.gz cd mod_wsgi-3.4 ./configure make clean make make install ldconfig ls /usr/lib/httpd/modules #should appear file mod_wsgi.so touch /etc/httpd/mod_wsgi.conf }}} Edit file '''/etc/httpd/httpd.conf''' and add {{{#!highlight sh Include /etc/httpd/mod_wsgi.conf Include /etc/httpd/vhosts.conf }}} Edit file '''/etc/httpd/mod_wsgi.conf''' and add {{{#!highlight sh LoadModule wsgi_module /usr/lib/httpd/modules/mod_wsgi.so }}} Restart apache with {{{#!highlight sh /etc/rc.d/rc.httpd restart }}} Check if mod_wsgi module is loaded with * tail /var/log/httpd/error_log | grep wsgi * Should appear '''mod_wsgi/3.4''' === Create test wsgi app === Create file '''/var/www/htdocs/test/test.wsgi''' {{{#!highlight python def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/html')]) yield '<html><body><h1>Test WSGI</h1></body></html>' }}} Create virtual host in /etc/httpd/vhosts.conf {{{#!highlight xml <VirtualHost *:80> ServerName localhosttestwsgi DocumentRoot "/var/www/htdocs/test" WSGIScriptAlias / /var/www/htdocs/test/test.wsgi ErrorLog /var/log/localhosttestwsgi-error_log CustomLog /var/log/localhosttestwsgi-access_log common <Directory "/var/www/htdocs/test"> Require local </Directory> </VirtualHost> }}} Add host to '''/etc/hosts''' {{{#!highlight sh 127.0.0.1 localhosttestwsgi }}} Restart apache {{{#!highlight sh /etc/rc.d/rc.httpd restart }}} Open url http://localhosttestwsgi/ and see if the string '''Test WSGI''' appears. |
modwsgi
Python WSGI adapter module for Apache.
Ubuntu installation 12.04
Create file /var/www/test.wsgi
Add to file /etc/apache2/sites-available/default inside the Virtual host the following
1 WSGIScriptAlias /test /var/www/test.wsgi
Slackware 14 installation
1 wget http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-3.4.tar.gz&can=1&q=
2 cp mod_wsgi-3.4.tar.gz /tmp
3 cd /tmp
4 tar xvzf mod_wsgi-3.4.tar.gz
5 cd mod_wsgi-3.4
6 ./configure
7 make clean
8 make
9 make install
10 ldconfig
11 ls /usr/lib/httpd/modules #should appear file mod_wsgi.so
12 touch /etc/httpd/mod_wsgi.conf
Edit file /etc/httpd/httpd.conf and add
Edit file /etc/httpd/mod_wsgi.conf and add
1 LoadModule wsgi_module /usr/lib/httpd/modules/mod_wsgi.so
Restart apache with
1 /etc/rc.d/rc.httpd restart
Check if mod_wsgi module is loaded with
- tail /var/log/httpd/error_log | grep wsgi
Should appear mod_wsgi/3.4
Create test wsgi app
Create file /var/www/htdocs/test/test.wsgi
Create virtual host in /etc/httpd/vhosts.conf
1 <VirtualHost *:80>
2 ServerName localhosttestwsgi
3 DocumentRoot "/var/www/htdocs/test"
4 WSGIScriptAlias / /var/www/htdocs/test/test.wsgi
5 ErrorLog /var/log/localhosttestwsgi-error_log
6 CustomLog /var/log/localhosttestwsgi-access_log common
7 <Directory "/var/www/htdocs/test">
8 Require local
9 </Directory>
10 </VirtualHost>
Add host to /etc/hosts
1 127.0.0.1 localhosttestwsgi
Restart apache
1 /etc/rc.d/rc.httpd restart
Open url http://localhosttestwsgi/ and see if the string Test WSGI appears.