2009/8/17 Kellie <[email protected]>: > > Hi, > > I am not using a virtual environment or sqlite3. (Thanks for the tip > though :) I really appreciate the fast replies. > > I am using mod_wsgi-2.5. > > Here are the relevant sections of my apache vhosts conf: > > <IfModule mod_wsgi.c> > WSGIScriptAlias /front /home/soda/django/thesodamachine/apache/ > django.wsgi > WSGIDaemonProcess thesodamachine.com processes=2 threads=15 display- > name=%{GROUP} > WSGIProcessGroup thesodamachine.com > </IfModule> > > <Directory /home/soda/django/thesodamachine/apache> > Order allow,deny > Allow from all > </Directory> > > <Directory /home/soda/django/thesodamachine/media> > Order allow,deny > Allow from all > </Directory> > > > LOGS: > > Apache error log (from cpanel) > > [Sun Aug 16 19:05:23 2009] [error] [client myip] mod_wsgi (pid=25028): > Exception occurred processing WSGI script '/home/soda/django/ > thesodamachine/apache/django.wsgi'. > [Sun Aug 16 19:05:23 2009] [error] [client myip] mod_wsgi (pid=25028): > Exception occurred processing WSGI script '/home/soda/django/ > thesodamachine/apache/django.wsgi'. > [Sun Aug 16 18:57:05 2009] [error] [client myip] mod_wsgi (pid=24708): > Exception occurred processing WSGI script '/home/soda/django/ > thesodamachine/apache/django.wsgi'. > > When I uncommented the lines to enable the admin in urls.py: > [Sun Aug 16 18:09:24 2009] [error] [client myip] mod_wsgi (pid=14363): > Exception occurred processing WSGI script '/home/soda/django/ > thesodamachine/apache/django.wsgi'. > [Sun Aug 16 17:49:55 2009] [error] [client myip] File "/home/soda/ > django/thesodamachine/apache/django.wsgi", line 4 > > > > Access log (from cpanel) > myip - - [16/Aug/2009:18:57:05 -0500] "GET / HTTP/1.1" 500 - "-" > "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/2009032711 > Ubuntu/8.04 (hardy) Firefox/3.0.8" > myip - - [16/Aug/2009:19:05:16 -0500] "GET / HTTP/1.1" 500 - "-" > "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko/2009032711 > Ubuntu/8.04 (hardy) Firefox/3.0.8" > > > Main apache log (from /etc/httpd/logs) > [Sun Aug 16 19:05:23 2009] [error] [client myip] mod_wsgi (pid=25028): > Exception occurred processing WSGI script '/home/soda/django/ > thesodamachine/apache/django.wsgi'. > [Sun Aug 16 19:05:23 2009] [error] [client myip] mod_wsgi (pid=25028): > Exception occurred processing WSGI script '/home/soda/django/ > thesodamachine/apache/django.wsgi'. > [Sun Aug 16 19:05:23 2009] [error] [client myip] Traceback (most > recent call last): > [Sun Aug 16 19:05:23 2009] [error] [client myip] Traceback (most > recent call last): > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 241, > in __call__ > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 241, > in __call__ > [Sun Aug 16 19:05:23 2009] [error] [client myip] response = > self.get_response(request) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/core/handlers/base.py", line 73, in > get_response > [Sun Aug 16 19:05:23 2009] [error] [client myip] response = > self.get_response(request) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/core/handlers/base.py", line 73, in > get_response > [Sun Aug 16 19:05:23 2009] [error] [client myip] response = > middleware_method(request) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/contrib/sessions/middleware.py", > line 10, in process_request > [Sun Aug 16 19:05:23 2009] [error] [client myip] response = > middleware_method(request) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/contrib/sessions/middleware.py", > line 10, in process_request > [Sun Aug 16 19:05:23 2009] [error] [client myip] engine = > import_module(settings.SESSION_ENGINE) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/utils/importlib.py", line 35, in > import_module > [Sun Aug 16 19:05:23 2009] [error] [client myip] engine = > import_module(settings.SESSION_ENGINE) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/utils/importlib.py", line 35, in > import_module > [Sun Aug 16 19:05:23 2009] [error] [client myip] __import__(name) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/contrib/sessions/backends/db.py", > line 2, in ? > [Sun Aug 16 19:05:23 2009] [error] [client myip] __import__(name) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/contrib/sessions/backends/db.py", > line 2, in ? > [Sun Aug 16 19:05:23 2009] [error] [client myip] from > django.contrib.sessions.models import Session > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/contrib/sessions/models.py", line > 4, in ? > [Sun Aug 16 19:05:23 2009] [error] [client myip] from > django.contrib.sessions.models import Session > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/contrib/sessions/models.py", line > 4, in ? > [Sun Aug 16 19:05:23 2009] [error] [client myip] from django.db > import models > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/db/__init__.py", line 41, in ? > [Sun Aug 16 19:05:23 2009] [error] [client myip] from django.db > import models > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/db/__init__.py", line 41, in ? > [Sun Aug 16 19:05:23 2009] [error] [client myip] backend = > load_backend(settings.DATABASE_ENGINE) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/db/__init__.py", line 17, in > load_backend > [Sun Aug 16 19:05:23 2009] [error] [client myip] return > import_module('.base', 'django.db.backends.%s' % backend_name) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/utils/importlib.py", line 35, in > import_module > [Sun Aug 16 19:05:23 2009] [error] [client myip] __import__(name) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/db/backends/mysql/base.py", line > 10, in ? > [Sun Aug 16 19:05:23 2009] [error] [client myip] backend = > load_backend(settings.DATABASE_ENGINE) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/db/__init__.py", line 17, in > load_backend > [Sun Aug 16 19:05:23 2009] [error] [client myip] return > import_module('.base', 'django.db.backends.%s' % backend_name) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/utils/importlib.py", line 35, in > import_module > [Sun Aug 16 19:05:23 2009] [error] [client myip] __import__(name) > [Sun Aug 16 19:05:23 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/db/backends/mysql/base.py", line > 10, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] import MySQLdb as > Database > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "build/ > bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "build/ > bdist.linux-i686/egg/_mysql.py", line 7, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "build/ > bdist.linux-i686/egg/_mysql.py", line 4, in __bootstrap__ > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 840, in resource_filename > [Sun Aug 16 19:05:24 2009] [error] [client myip] import MySQLdb as > Database > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "build/ > bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "build/ > bdist.linux-i686/egg/_mysql.py", line 7, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "build/ > bdist.linux-i686/egg/_mysql.py", line 4, in __bootstrap__ > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 840, in resource_filename > [Sun Aug 16 19:05:24 2009] [error] [client myip] return > get_provider(package_or_requirement).get_resource_filename( > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 1310, in get_resource_filename > [Sun Aug 16 19:05:24 2009] [error] [client myip] return > get_provider(package_or_requirement).get_resource_filename( > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 1310, in get_resource_filename > [Sun Aug 16 19:05:24 2009] [error] [client myip] > self._extract_resource(manager, self._eager_to_zip(name)) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 1331, in _extract_resource > [Sun Aug 16 19:05:24 2009] [error] [client myip] real_path = > manager.get_cache_path( > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 921, in get_cache_path > [Sun Aug 16 19:05:24 2009] [error] [client myip] > self.extraction_error() > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 887, in extraction_error > [Sun Aug 16 19:05:24 2009] [error] [client myip] raise err > [Sun Aug 16 19:05:24 2009] [error] [client myip] ExtractionError: > Can't extract file(s) to egg cache > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] The following error > occurred while trying to extract file(s) to the Python egg > [Sun Aug 16 19:05:24 2009] [error] [client myip] cache: > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] [Errno 13] > Permission denied: '/.python-eggs' > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] The Python egg cache > directory is currently set to: > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] /.python-eggs > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] Perhaps your account > does not have write access to this directory? You can > [Sun Aug 16 19:05:24 2009] [error] [client myip] change the cache > directory by setting the PYTHON_EGG_CACHE environment > [Sun Aug 16 19:05:24 2009] [error] [client myip] variable to point to > an accessible directory. > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] > self._extract_resource(manager, self._eager_to_zip(name)) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 1331, in _extract_resource > [Sun Aug 16 19:05:24 2009] [error] [client myip] real_path = > manager.get_cache_path( > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 921, in get_cache_path > [Sun Aug 16 19:05:24 2009] [error] [client myip] > self.extraction_error() > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 887, in extraction_error > [Sun Aug 16 19:05:24 2009] [error] [client myip] raise err > [Sun Aug 16 19:05:24 2009] [error] [client myip] ExtractionError: > Can't extract file(s) to egg cache > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] The following error > occurred while trying to extract file(s) to the Python egg > [Sun Aug 16 19:05:24 2009] [error] [client myip] cache: > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] [Errno 13] > Permission denied: '/.python-eggs' > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] The Python egg cache > directory is currently set to: > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] /.python-eggs > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] Perhaps your account > does not have write access to this directory? You can > [Sun Aug 16 19:05:24 2009] [error] [client myip] change the cache > directory by setting the PYTHON_EGG_CACHE environment > [Sun Aug 16 19:05:24 2009] [error] [client myip] variable to point to > an accessible directory. > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] mod_wsgi (pid=25028): > Exception occurred processing WSGI script '/home/soda/django/ > thesodamachine/apache/django.wsgi'. > [Sun Aug 16 19:05:24 2009] [error] [client myip] Traceback (most > recent call last): > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 241, > in __call__ > [Sun Aug 16 19:05:24 2009] [error] [client myip] response = > self.get_response(request) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/core/handlers/base.py", line 73, in > get_response > [Sun Aug 16 19:05:24 2009] [error] [client myip] response = > middleware_method(request) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/contrib/sessions/middleware.py", > line 10, in process_request > [Sun Aug 16 19:05:24 2009] [error] [client myip] engine = > import_module(settings.SESSION_ENGINE) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/utils/importlib.py", line 35, in > import_module > [Sun Aug 16 19:05:24 2009] [error] [client myip] __import__(name) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/contrib/sessions/backends/db.py", > line 2, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] from > django.contrib.sessions.models import Session > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/contrib/sessions/models.py", line > 4, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] from django.db > import models > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/db/__init__.py", line 41, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] backend = > load_backend(settings.DATABASE_ENGINE) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/db/__init__.py", line 17, in > load_backend > [Sun Aug 16 19:05:24 2009] [error] [client myip] return > import_module('.base', 'django.db.backends.%s' % backend_name) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/utils/importlib.py", line 35, in > import_module > [Sun Aug 16 19:05:24 2009] [error] [client myip] __import__(name) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/django/db/backends/mysql/base.py", line > 10, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] import MySQLdb as > Database > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "build/ > bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "build/ > bdist.linux-i686/egg/_mysql.py", line 7, in ? > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "build/ > bdist.linux-i686/egg/_mysql.py", line 4, in __bootstrap__ > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 840, in resource_filename > [Sun Aug 16 19:05:24 2009] [error] [client myip] return > get_provider(package_or_requirement).get_resource_filename( > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 1310, in get_resource_filename > [Sun Aug 16 19:05:24 2009] [error] [client myip] > self._extract_resource(manager, self._eager_to_zip(name)) > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 1331, in _extract_resource > [Sun Aug 16 19:05:24 2009] [error] [client myip] real_path = > manager.get_cache_path( > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 921, in get_cache_path > [Sun Aug 16 19:05:24 2009] [error] [client myip] > self.extraction_error() > [Sun Aug 16 19:05:24 2009] [error] [client myip] File "/usr/local/ > lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/ > pkg_resources.py", line 887, in extraction_error > [Sun Aug 16 19:05:24 2009] [error] [client myip] raise err > [Sun Aug 16 19:05:24 2009] [error] [client myip] ExtractionError: > Can't extract file(s) to egg cache > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] The following error > occurred while trying to extract file(s) to the Python egg > [Sun Aug 16 19:05:24 2009] [error] [client myip] cache: > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] [Errno 13] > Permission denied: '/.python-eggs' > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] The Python egg cache > directory is currently set to: > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] /.python-eggs > [Sun Aug 16 19:05:24 2009] [error] [client myip] > [Sun Aug 16 19:05:24 2009] [error] [client myip] Perhaps your account > does not have write access to this directory? You can > [Sun Aug 16 19:05:24 2009] [error] [client myip] change the cache > directory by setting the PYTHON_EGG_CACHE environment > [Sun Aug 16 19:05:24 2009] [error] [client myip] variable to point to > an accessible directory. > [Sun Aug 16 19:05:24 2009] [error] [client myip]
As the error says and other poster mentioned, this is an issue with access to Python egg cache by user that daemon process runs as, in this case the Apache user. There are a few things you can do to end up with a writable Python egg cache. First off though, I will highlight that I do not recommend use of /tmp for the Python egg cache directory as other poster mentioned. This is because that directory is writable by any user and can often be full of crap. Although using it will normally work, I discourage it mainly because that it is writable by any user means that in a shared hosting environment you could inadvertently, or through malicious intent pick up code put there by another user. For that reason, even if your own system and no one else using it, I will always so don't do it, as I don't want people posting on blogs to mention doing it that way as some unknowing person will then try and do the same on a shared hosting environment. To overcome the issue of non writable Python egg cache, suggest that following options: 1. If using daemon mode, then run the daemon mode process as you, by using the user/group options to WSGIDaemonProcess directive. This solves various problems with write access as it will have same write access as you would have when developing or working on code and so do not need to open up access to Apache user. This access will include being able to access and use the Python egg cache directory that would likely already exist in your home directory. 2. If wish to use daemon mode but still run it as a special user, then use the python-eggs option to WSGIDaemonProcess to specify a daemon process group wide location for the Python egg cache directory. This directory should be writable to user that daemon process runs as, default is Apache user. Just don't use /tmp. 3. If using embedded mode, the equivalent to the python-eggs option for WSGIDaemonProcess directive is the WSGIPythonEggs directive. This directive doesn't apply to daemon mode processes. The directory should be writable to user that Apache runs as after root privileges dropped. 4. Set PYTHON_EGG_CACHE environment variable in WSGI script file by updating os.environ dictionary. Doing it in the WSGI script file means location is specific to that sub interpreter of the process. Can be used with embedded mode or daemon mode. The directory should be writable to user that process runs as. For further information and description of original problem, see: http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonEggs Graham --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en -~----------~----~----~----~------~----~------~--~---
