First time here? Check out the FAQ!

Revision history  [back]

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=301]
     </LocationMatch>

     Alias /admin/media/ /home/askbot/virtual/askbot/lib64/python2.6/site-packages/django/contrib/admin/media/
     WSGIScriptAlias / /home/askbot/askbotdjangosite/django.wsgi
</VirtualHost>

ldd outputs of wsgi and python2.6

ldd /usr/lib64/httpd/modules/mod_wsgi.so

    linux-vdso.so.1 =>  (0x00007fffae1ff000)
    libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007fa48d7c3000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa48d5a6000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fa48d3a1000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00007fa48d19e000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fa48cf1a000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fa48cb85000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003634800000)

ldd /usr/bin/python2.6

    linux-vdso.so.1 =>  (0x00007fff7bdff000)
    libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x0000003638800000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003635400000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003634c00000)
    libutil.so.1 => /lib64/libutil.so.1 (0x0000003636800000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003636000000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003635000000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003634800000)

Installing askbot for intranet use, Any help how to solve this error.

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=301]
     </LocationMatch>

     Alias /admin/media/ /home/askbot/virtual/askbot/lib64/python2.6/site-packages/django/contrib/admin/media/
     WSGIScriptAlias / /home/askbot/askbotdjangosite/django.wsgi
</VirtualHost>

ldd outputs of wsgi and python2.6

ldd /usr/lib64/httpd/modules/mod_wsgi.so

    linux-vdso.so.1 =>  (0x00007fffae1ff000)
    libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007fa48d7c3000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa48d5a6000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fa48d3a1000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00007fa48d19e000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fa48cf1a000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fa48cb85000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003634800000)

ldd /usr/bin/python2.6

    linux-vdso.so.1 =>  (0x00007fff7bdff000)
    libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x0000003638800000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003635400000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003634c00000)
    libutil.so.1 => /lib64/libutil.so.1 (0x0000003636800000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003636000000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003635000000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003634800000)

Installing askbot for intranet use, Any help how to solve this error.