First time here? Check out the FAQ!

Revision history  [back]

Installation under Apache/mod_wsgi: "ImportError: No module named site"

I try to setting apache webserver for running askbot in my local machine but i get this error in /var/log/httpd/error_log:

[Mon Mar 12 16:21:24 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Mar 12 16:21:24 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Mar 12 16:21:24 2012] [notice] Digest: generating secret for digest authentication ...
[Mon Mar 12 16:21:24 2012] [notice] Digest: done
[Mon Mar 12 16:21:25 2012] [notice] Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0g DAV/2 mod_wsgi/3.3 Python/2.7.2 configured -- resuming normal operations
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site

This is my configuration for apache

#NOTE: the directory paths used here may be adjusted

#the following two directories must be both readable and writable by apache
WSGISocketPrefix /var/run/wsgi
#WSGIPythonEggs /usr/lib/python2.7/site-packages/

#the following directory must be readable by apache
WSGIPythonHome /usr/lib/python2.7

#NOTE: all urs below will need to be adjusted if
#settings.FORUM_SCRIPT_ALIAS is anything other than empty string (e.g. = 'forum/')
#this allows "rooting" forum at http://example.com/forum, if you like

#replace with 127.0.0.1 with real IP address
<VirtualHost 127.0.0.1:80>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath/
    ServerName example.come

    #aliases to serve static media directly
    #will probably need adjustment
    Alias /static/ /home/relax/Temp/askmath/static/
    Alias /upfiles/ /home/relax/Temp/askmath/askbot/upfiles/
    <DirectoryMatch "/home/relax/Temp/askmath/askbot/skins/([^/]+)/media">
    Order deny,allow
    Allow from all
    </DirectoryMatch>
    <Directory "/home/relax/Temp/askmath/askbot/upfiles">
    Order deny,allow
    Allow from all
    </Directory>
    #must be a distinct name within your apache configuration
    WSGIDaemonProcess askbot2
    WSGIProcessGroup askbot2
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    #make all admin stuff except media go through secure connection
    <LocationMatch "/admin(?!/media)">
    RewriteEngine on
    RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301]
    </LocationMatch>
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
    LogLevel debug
</VirtualHost>
#again, replace the IP address
<VirtualHost 127.0.0.1:443>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath
    ServerName example.com
    <LocationMatch "^(?!/admin)">
    RewriteEngine on
    RewriteRule django.wsgi(.*)$ http://example.com$1 [L,R=301]
    </LocationMatch>
    SSLEngine on
    #your SSL keys
    SSLCertificateFile /etc/httpd/conf/server.crt
    SSLCertificateKeyFile /etc/httpd/conf/server.key
    Alias /admin/media/ /usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/contrib/admin/media
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
</VirtualHost>

Adding

import sys
sys.stderr.write('\n'.join(sys.path))

at the end of the django.wsgi and running "python2 django.wsgi" i get this paths

/home/relax/Temp/askmath
/home/relax/Temp/askmath
/usr/lib/python2.7/site-packages/django_threaded_multihost-1.4_1-py2.7.egg
/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg
/usr/lib/python2.7/site-packages/Coffin-0.3.6-py2.7.egg
/usr/lib/python2.7/site-packages/django_recaptcha_works-0.3.4-py2.7.egg
/usr/lib/python2.7/site-packages/markdown2-1.1.1-py2.7.egg
/usr/lib/python2.7/site-packages/akismet-0.2.0-py2.7.egg
/usr/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg
/usr/lib/python2.7/site-packages/django_countries-1.0.5-py2.7.egg
/usr/lib/python2.7/site-packages/django_kombu-0.9.2-py2.7.egg
/usr/lib/python2.7/site-packages/html5lib-0.90-py2.7.egg
/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg
/usr/lib/python2.7/site-packages/django_keyedcache-1.4_6-py2.7.egg
/usr/lib/python2.7/site-packages/django_robots-0.8.1-py2.7.egg
/usr/lib/python2.7/site-packages/django_celery-2.2.7-py2.7.egg
/usr/lib/python2.7/site-packages/pystache-0.3.1-py2.7.egg
/usr/lib/python2.7/site-packages/python_openid-2.2.5-py2.7.egg
/usr/lib/python2.7/site-packages/oauth2-1.5.211-py2.7.egg
/usr/lib/python2.7/site-packages/Unidecode-0.04.9-py2.7.egg
/usr/lib/python2.7/site-packages/django_followit-0.0.3-py2.7.egg
/usr/lib/python2.7/site-packages/celery-2.2.7-py2.7.egg
/usr/lib/python2.7/site-packages/django_picklefield-0.2.0-py2.7.egg
/usr/lib/python2.7/site-packages/httplib2-0.7.4-py2.7.egg
/usr/lib/python2.7/site-packages/pyparsing-1.5.6-py2.7.egg
/usr/lib/python2.7/site-packages/kombu-1.5.1-py2.7.egg
/usr/lib/python2.7/site-packages/anyjson-0.3.1-py2.7.egg
/usr/lib/python2.7/site-packages/python_dateutil-1.5-py2.7.egg
/usr/lib/python2.7/site-packages/amqplib-1.0.2-py2.7.egg
/usr/lib/python27.zip
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/gtk-2.0
/usr/lib/python2.7/site-packages/setuptools-0.6c11.egg-info

How can i fix this problem? Thanks in advance

Installation under Apache/mod_wsgi: "ImportError: No module named site"

I try to setting apache webserver for running askbot in my local machine but i get this error in /var/log/httpd/error_log:

[Mon Mar 12 16:21:24 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Mar 12 16:21:24 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Mar 12 16:21:24 2012] [notice] Digest: generating secret for digest authentication ...
[Mon Mar 12 16:21:24 2012] [notice] Digest: done
[Mon Mar 12 16:21:25 2012] [notice] Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0g DAV/2 mod_wsgi/3.3 Python/2.7.2 configured -- resuming normal operations
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site

This is my configuration for apache

#NOTE: the directory paths used here may be adjusted

#the following two directories must be both readable and writable by apache
WSGISocketPrefix /var/run/wsgi
#WSGIPythonEggs /usr/lib/python2.7/site-packages/

#the following directory must be readable by apache
WSGIPythonHome /usr/lib/python2.7

#NOTE: all urs below will need to be adjusted if
#settings.FORUM_SCRIPT_ALIAS is anything other than empty string (e.g. = 'forum/')
#this allows "rooting" forum at http://example.com/forum, if you like

#replace with 127.0.0.1 with real IP address
<VirtualHost 127.0.0.1:80>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath/
    ServerName example.come

    #aliases to serve static media directly
    #will probably need adjustment
    Alias /static/ /home/relax/Temp/askmath/static/
    Alias /upfiles/ /home/relax/Temp/askmath/askbot/upfiles/
    <DirectoryMatch "/home/relax/Temp/askmath/askbot/skins/([^/]+)/media">
    Order deny,allow
    Allow from all
    </DirectoryMatch>
    <Directory "/home/relax/Temp/askmath/askbot/upfiles">
    Order deny,allow
    Allow from all
    </Directory>
    #must be a distinct name within your apache configuration
    WSGIDaemonProcess askbot2
    WSGIProcessGroup askbot2
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    #make all admin stuff except media go through secure connection
    <LocationMatch "/admin(?!/media)">
    RewriteEngine on
    RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301]
    </LocationMatch>
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
    LogLevel debug
</VirtualHost>
#again, replace the IP address
<VirtualHost 127.0.0.1:443>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath
    ServerName example.com
    <LocationMatch "^(?!/admin)">
    RewriteEngine on
    RewriteRule django.wsgi(.*)$ http://example.com$1 [L,R=301]
    </LocationMatch>
    SSLEngine on
    #your SSL keys
    SSLCertificateFile /etc/httpd/conf/server.crt
    SSLCertificateKeyFile /etc/httpd/conf/server.key
    Alias /admin/media/ /usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/contrib/admin/media
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
</VirtualHost>

Adding

import sys
sys.stderr.write('\n'.join(sys.path))

at the end of the django.wsgi and running "python2 django.wsgi" i get this paths

/home/relax/Temp/askmath
/home/relax/Temp/askmath
/usr/lib/python2.7/site-packages/django_threaded_multihost-1.4_1-py2.7.egg
/usr/lib/python2.7/site-packages/South-0.7.3-py2.7.egg
/usr/lib/python2.7/site-packages/Coffin-0.3.6-py2.7.egg
/usr/lib/python2.7/site-packages/django_recaptcha_works-0.3.4-py2.7.egg
/usr/lib/python2.7/site-packages/markdown2-1.1.1-py2.7.egg
/usr/lib/python2.7/site-packages/akismet-0.2.0-py2.7.egg
/usr/lib/python2.7/site-packages/Jinja2-2.6-py2.7.egg
/usr/lib/python2.7/site-packages/django_countries-1.0.5-py2.7.egg
/usr/lib/python2.7/site-packages/django_kombu-0.9.2-py2.7.egg
/usr/lib/python2.7/site-packages/html5lib-0.90-py2.7.egg
/usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg
/usr/lib/python2.7/site-packages/django_keyedcache-1.4_6-py2.7.egg
/usr/lib/python2.7/site-packages/django_robots-0.8.1-py2.7.egg
/usr/lib/python2.7/site-packages/django_celery-2.2.7-py2.7.egg
/usr/lib/python2.7/site-packages/pystache-0.3.1-py2.7.egg
/usr/lib/python2.7/site-packages/python_openid-2.2.5-py2.7.egg
/usr/lib/python2.7/site-packages/oauth2-1.5.211-py2.7.egg
/usr/lib/python2.7/site-packages/Unidecode-0.04.9-py2.7.egg
/usr/lib/python2.7/site-packages/django_followit-0.0.3-py2.7.egg
/usr/lib/python2.7/site-packages/celery-2.2.7-py2.7.egg
/usr/lib/python2.7/site-packages/django_picklefield-0.2.0-py2.7.egg
/usr/lib/python2.7/site-packages/httplib2-0.7.4-py2.7.egg
/usr/lib/python2.7/site-packages/pyparsing-1.5.6-py2.7.egg
/usr/lib/python2.7/site-packages/kombu-1.5.1-py2.7.egg
/usr/lib/python2.7/site-packages/anyjson-0.3.1-py2.7.egg
/usr/lib/python2.7/site-packages/python_dateutil-1.5-py2.7.egg
/usr/lib/python2.7/site-packages/amqplib-1.0.2-py2.7.egg
/usr/lib/python27.zip
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/gtk-2.0
/usr/lib/python2.7/site-packages/setuptools-0.6c11.egg-info

How can i fix this problem? Thanks in advance

Installation under Apache/mod_wsgi: "ImportError: No module named site"

I try to setting apache webserver for running askbot in my local machine but i get this error in /var/log/httpd/error_log:

[Mon Mar 12 16:21:24 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Mar 12 16:21:24 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Mar 12 16:21:24 2012] [notice] Digest: generating secret for digest authentication ...
[Mon Mar 12 16:21:24 2012] [notice] Digest: done
[Mon Mar 12 16:21:25 2012] [notice] Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0g DAV/2 mod_wsgi/3.3 Python/2.7.2 configured -- resuming normal operations
P$
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site

This is my configuration for apache

#NOTE: the directory paths used here may be adjusted

#the following two directories must be both readable and writable by apache
WSGISocketPrefix /var/run/wsgi
#WSGIPythonEggs /usr/lib/python2.7/site-packages/

#the following directory must be readable by apache
WSGIPythonHome /usr/lib/python2.7

#NOTE: all urs below will need to be adjusted if
#settings.FORUM_SCRIPT_ALIAS is anything other than empty string (e.g. = 'forum/')
#this allows "rooting" forum at http://example.com/forum, if you like

#replace with 127.0.0.1 with real IP address
<VirtualHost 127.0.0.1:80>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath/
    ServerName example.come

    #aliases to serve static media directly
    #will probably need adjustment
    Alias /static/ /home/relax/Temp/askmath/static/
    Alias /upfiles/ /home/relax/Temp/askmath/askbot/upfiles/
    <DirectoryMatch "/home/relax/Temp/askmath/askbot/skins/([^/]+)/media">
    Order deny,allow
    Allow from all
    </DirectoryMatch>
    <Directory "/home/relax/Temp/askmath/askbot/upfiles">
    Order deny,allow
    Allow from all
    </Directory>
    #must be a distinct name within your apache configuration
    WSGIDaemonProcess askbot2
    WSGIProcessGroup askbot2
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    #make all admin stuff except media go through secure connection
    <LocationMatch "/admin(?!/media)">
    RewriteEngine on
    RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301]
    </LocationMatch>
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
    LogLevel debug
</VirtualHost>
#again, replace the IP address
<VirtualHost 127.0.0.1:443>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath
    ServerName example.com
    <LocationMatch "^(?!/admin)">
    RewriteEngine on
    RewriteRule django.wsgi(.*)$ http://example.com$1 [L,R=301]
    </LocationMatch>
    SSLEngine on
    #your SSL keys
    SSLCertificateFile /etc/httpd/conf/server.crt
    SSLCertificateKeyFile /etc/httpd/conf/server.key
    Alias /admin/media/ /usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/contrib/admin/media
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
</VirtualHost>

How can i fix this problem? Thanks in advance

Installation under Apache/mod_wsgi: "ImportError: No module named site"

I try to setting apache webserver for running askbot in my local machine but i get this error in /var/log/httpd/error_log:

[Mon Mar 12 16:21:24 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Mar 12 16:21:24 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Mar 12 16:21:24 2012] [notice] Digest: generating secret for digest authentication ...
[Mon Mar 12 16:21:24 2012] [notice] Digest: done
[Mon Mar 12 16:21:25 2012] [notice] Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0g DAV/2 mod_wsgi/3.3 P$
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site

This is my configuration for apache

#NOTE: the directory paths used here may be adjusted

#the following two directories must be both readable and writable by apache
WSGISocketPrefix /var/run/wsgi
#WSGIPythonEggs /usr/lib/python2.7/site-packages/

#the following directory must be readable by apache
WSGIPythonHome /usr/lib/python2.7

#NOTE: all urs below will need to be adjusted if
#settings.FORUM_SCRIPT_ALIAS is anything other than empty string (e.g. = 'forum/')
#this allows "rooting" forum at http://example.com/forum, if you like

#replace with 127.0.0.1 with real IP address
<VirtualHost 127.0.0.1:80>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath/
    ServerName example.come

    #aliases to serve static media directly
    #will probably need adjustment
    Alias /static/ /home/relax/Temp/askmath/static/
    Alias /upfiles/ /home/relax/Temp/askmath/askbot/upfiles/
    <DirectoryMatch "/home/relax/Temp/askmath/askbot/skins/([^/]+)/media">
    Order deny,allow
    Allow from all
    </DirectoryMatch>
    <Directory "/home/relax/Temp/askmath/askbot/upfiles">
    Order deny,allow
    Allow from all
    </Directory>
    #must be a distinct name within your apache configuration
    WSGIDaemonProcess askbot2
    WSGIProcessGroup askbot2
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    #make all admin stuff except media go through secure connection
    <LocationMatch "/admin(?!/media)">
    RewriteEngine on
    RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301]
    </LocationMatch>
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
    LogLevel debug
</VirtualHost>
#again, replace the IP address
<VirtualHost 127.0.0.1:443>
    ServerAdmin you@example.com
    DocumentRoot /home/relax/Temp/askmath
    ServerName example.com
    <LocationMatch "^(?!/admin)">
    RewriteEngine on
    RewriteRule django.wsgi(.*)$ http://example.com$1 [L,R=301]
    </LocationMatch>
    SSLEngine on
    #your SSL keys
    SSLCertificateFile /etc/httpd/conf/server.crt
    SSLCertificateKeyFile /etc/httpd/conf/server.key
    Alias /admin/media/ /usr/lib/python2.7/site-packages/Django-1.3.1-py2.7.egg/django/contrib/admin/media
    WSGIScriptAlias / /home/relax/Temp/askmath/django.wsgi
    CustomLog /home/relax/Temp/askmath/log/access_log common
    ErrorLog /home/relax/Temp/askmath/log/error_log
</VirtualHost>

How can i fix this problem? Thanks in advance

Installation under Apache/mod_wsgi: "ImportError: No module named site"Apache/mod_wsgi:

I try to setting apache webserver for running askbot in my local machine but i get this error in /var/log/httpd/error_log:

[Mon Mar 12 16:21:24 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Mar 12 16:21:24 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Mar 12 16:21:24 2012] [notice] Digest: generating secret for digest authentication ...
[Mon Mar 12 16:21:24 2012] [notice] Digest: done
[Mon Mar 12 16:21:25 2012] [notice] Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0g DAV/2 mod_wsgi/3.3 P$
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site
ImportError: No module named site

How can i fix this problem? Thanks in advance