Askbot Python2.6 Django VirtualEnv PostgreSQL ImportError : No module named OS
Installed askbot using pip in my Centos 6.5 and having issues while trying to access from browsers. Following is the error message displayed in my Apache error_log while accessing it through browser
[Fri Dec 19 18:16:14 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Dec 19 18:16:14 2014] [notice] Digest: generating secret for digest authentication ...
[Fri Dec 19 18:16:14 2014] [notice] Digest: done
[Fri Dec 19 18:16:14 2014] [notice] Apache/2.2.15 (Unix) DAV/2 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips mod_wsgi/3.2 Python/2.6.6 configured -- resuming normal operations
[Fri Dec 19 18:16:14 2014] [info] mod_wsgi (pid=8088): Attach interpreter ''.
[Fri Dec 19 18:16:32 2014] [info] mod_wsgi (pid=8088): Create interpreter 'communitydev.india.vembu.com.100.168.192.in-addr.arpa|'.
[Fri Dec 19 18:16:32 2014] [info] [client 192.168.100.45] mod_wsgi (pid=8088, process='askbot', application='communitydev.india.vembu.com.100.168.192.in-addr.arpa|'): Loading WSGI script '/home/askbot/askbotdjangosite/django.wsgi'.
[Fri Dec 19 18:16:32 2014] [error] [client 192.168.100.45] mod_wsgi (pid=8088): Target WSGI script '/home/askbot/askbotdjangosite/django.wsgi' cannot be loaded as Python module.
[Fri Dec 19 18:16:32 2014] [error] [client 192.168.100.45] mod_wsgi (pid=8088): Exception occurred processing WSGI script '/home/askbot/askbotdjangosite/django.wsgi'.
[Fri Dec 19 18:16:32 2014] [error] Traceback (most recent call last):
[Fri Dec 19 18:16:32 2014] [error] File "/home/askbot/askbotdjangosite/django.wsgi", line 1, in <module>
[Fri Dec 19 18:16:32 2014] [error] import os
[Fri Dec 19 18:16:32 2014] [error] ImportError: No module named os
Following is my wsgi.conf file contents
LoadModule wsgi_module modules/mod_wsgi.so
#the following two directories must be both readable and writable by apache
WSGISocketPrefix /var/run/wsgi
WSGIPythonEggs /var/python/eggs
#the following directory must be readable by apache
WSGIPythonHome /usr/lib64/python2.6
Following is my vhosts.conf file content
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /home/askbot/askbotdjangosite/
ServerAlias Communitydev
ErrorLog logs/error_log
CustomLog logs/access_log combined
LogLevel debug
Alias /m/ /home/askbot/askbotdjangosite/static/
Alias /upfiles/ /home/askbot/askbotdjangosite/askbot/upfiles/
<DirectoryMatch "/home/askbot/askbotdjangosite/askbot/skins/([^/]+)/media">
Order deny,allow
Allow from all
</DirectoryMatch>
<Directory "/home/askbot/askbotdjangosite/askbot/upfiles">
Order deny,allow
Allow from all
</Directory>
#must be a distinct name within your apache configuration
WSGIDaemonProcess askbot
WSGIProcessGroup askbot
WSGIScriptAlias / /home/askbot/askbotdjangosite/django.wsgi
#make all admin stuff except media go through secure connection
<LocationMatch "/admin(?!/media)">
RewriteEngine on
RewriteRule /admin(.*)$ https : / /Communitydev/admin$1 [L,R=301]
</LocationMatch>
</VirtualHost>
NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/httpd/ssl/apache.crt
SSLCertificateKeyFile /etc/httpd/ssl/apache.key
ServerName "Communitydev"
DocumentRoot /home/askbot/askbotdjangosite/
CustomLog logs/ssl_access_log combined
ErrorLog logs/ssl_error_log
<LocationMatch "^(?!/admin)">
RewriteEngine on
RewriteRule django.wsgi(.*)$ http : / / example.com$1 [L,R ...
Comments
Just a quick note, this is not an Askbot issue, but something more general regarding the apache configuration and/or your Python installation. Looks like an issue with the pythonpath.
@Evgeny Yes, I agree that this is not an issue with askbot. Am new to Python environment, any idea how to proceed further in solving this problem.
Sorry I don't have the time at the moment. Hopefully either someone else helps or you will find the solution elsewhere. I would recommend instead use nginx + uwsgi, the setup is simpler than with Apache. Please look for a general solution of type "how to deploy a django application.