Ubuntu version: 10.10 Server
- Install apache server
aptitude install apache2
- Check if it works: 127.0.0.1 should give you: “It works!”
- Install Python WSGI adapter module for Apache
aptitude install libapache2-mod-wsgi
- Disable the default apache site:
a2dissite 000-default
(or any other site in: /etc/apache2/sites-enabled) - Install easy_install for python
apt-get install python-setuptools python-dev build-essential
- Set the proxy if necessary:
export HTTP_PROXY=http://user:pass@10.60.30.248:8080/
- easy_install paste
- aptitude install python-pastedeploy
- easy_install SQLAlchemy
- easy_install Pylons
- add www-data user to your user group
usermod -a -G simplesite www-data
- set debug = false in your development.ini
[DEFAULT]
debug = false
- move you application to: /usr/lib/pymodules/python2.6
<VirtualHost *> ServerName etiopia ServerAlias etiopia # Logfiles ErrorLog /var/log/apache2/error.log CustomLog /var/log/apache2/access.log combined # Setup mod_wsgi WSGIScriptAlias / /home/ubuntu/OBIAD/dispatch.wsgi <Directory /home/ubuntu/OBIAD> Order deny,allow Allow from all </Directory> </VirtualHost>
|
/home/ubuntu/OBIAD/dispatch.wsgi:
#Load the Pylons application from paste.deploy import loadapp application = loadapp('config:/home/ubuntu/OBIAD/development.ini') |
Restart apache with:
/etc/init.d/apache2 restart
Look for any errors in: /var/log/apache2/error.log
While starting apache I had the following error. Despite this everything worked fine (There was a bug and we can ignore this error):
[error] Exception KeyError: KeyError(140024401471296,) in <module 'threading' from '/usr/lib/python2.6/threading.pyc'> ignored [error] Exception KeyError: KeyError(140024401471296,) in <module 'threading' from '/usr/lib/python2.6/threading.pyc'> ignored [notice] caught SIGTERM, shutting down [warn] mod_wsgi: Compiled for Python/2.6.5. [warn] mod_wsgi: Runtime using Python/2.6.6. [notice] Apache/2.2.16 (Ubuntu) mod_wsgi/3.2 Python/2.6.6 configured -- resuming normal operations |
ImportError: No module named paste.deploy –> install paste with “easy_install paste”
ImportError: No module named deploy –> aptitude install python-pastedeploy
OSError: File '/home/ubuntu/OBIAD/development.ini' not found –> copy your *.ini from you application to the destination directory
DistributionNotFound: dinner –> you haven’t copied your application to destination directory (/usr/lib/pymodules/python2.6/)
DistributionNotFound: SQLAlchemy>=0.5 –> easy_install SQLAlchemy
Proxy causing errors. If you see any of the messages:
it’s probably your proxy causing problems. Mod_wsgi does not do well with proxies unfortunately. |