2008/11/26 Graham Dumpleton <[EMAIL PROTECTED]>: > 2008/11/25 z3rgl1ng <[EMAIL PROTECTED]>: >> >> Hi, >> >> I installed on a CentOS system running Cpanel a new version of python >> with mod_wsgi + django >> I followed this: >> http://m.andric.us/post/43754517/django-python-mod-wsgi-with-cpanel-whm >> >> Now the problem is that i'm getting a lot of errors in my error_log, >> and here are the errors: >> >> mod_wsgi (pid=16571): Exception occurred processing WSGI script '/ >> home/johnyb/myapp.wsgi'. >> Traceback (most recent call last): >> File "/opt/local/lib/python2.5/site-packages/django/core/handlers/ >> wsgi.py", line 239, in __call__ >> response = self.get_response(request) >> File "/opt/local/lib/python2.5/site-packages/django/core/handlers/ >> base.py", line 67, in get_response >> response = middleware_method(request) >> File "/opt/local/lib/python2.5/site-packages/django/contrib/ >> sessions/middleware.py", line 9, in process_request >> engine = __import__(settings.SESSION_ENGINE, {}, {}, ['']) >> File "/opt/local/lib/python2.5/site-packages/django/contrib/ >> sessions/backends/db.py", line 2, in <module> >> from django.contrib.sessions.models import Session >> File "/opt/local/lib/python2.5/site-packages/django/contrib/ >> sessions/models.py", line 4, in <module> >> from django.db import models >> File "/opt/local/lib/python2.5/site-packages/django/db/ >> __init__.py", line 16, in <module> >> backend = __import__('%s%s.base' % (_import_path, >> settings.DATABASE_ENGINE), {}, {}, ['']) >> File "/opt/local/lib/python2.5/site-packages/django/db/backends/ >> mysql/base.py", line 10, in <module> >> import MySQLdb as Database >> File "/opt/local/lib/python2.5/site-packages/MySQL_python-1.2.2- >> py2.5-linux-i686.egg/MySQLdb/__init__.py", line 19, in <module> >> File "/opt/local/lib/python2.5/site-packages/MySQL_python-1.2.2- >> py2.5-linux-i686.egg/_mysql.py", line 7, in <module> >> File "/opt/local/lib/python2.5/site-packages/MySQL_python-1.2.2- >> py2.5-linux-i686.egg/_mysql.py", line 3, in __bootstrap__ >> File "/opt/local/lib/python2.5/site-packages/setuptools-0.6c5- >> py2.5.egg/pkg_resources.py", line 2470, in <module> >> File "/opt/local/lib/python2.5/site-packages/setuptools-0.6c5- >> py2.5.egg/pkg_resources.py", line 343, in __init__ >> File "/opt/local/lib/python2.5/site-packages/setuptools-0.6c5- >> py2.5.egg/pkg_resources.py", line 358, in add_entry >> File "/opt/local/lib/python2.5/site-packages/setuptools-0.6c5- >> py2.5.egg/pkg_resources.py", line 1577, in find_on_path >> OSError: [Errno 13] Permission denied: '/home/johnyb' >> mod_wsgi (pid=16579): Exception occurred processing WSGI script '/ >> home/johnyb/myapp.wsgi'. >> Traceback (most recent call last): >> File "/opt/local/lib/python2.5/site-packages/django/core/handlers/ >> wsgi.py", line 239, in __call__ >> response = self.get_response(request) >> File "/opt/local/lib/python2.5/site-packages/django/core/handlers/ >> base.py", line 67, in get_response >> response = middleware_method(request) >> File "/opt/local/lib/python2.5/site-packages/django/middleware/ >> common.py", line 56, in process_request >> if (not _is_valid_path(request.path_info) and >> File "/opt/local/lib/python2.5/site-packages/django/middleware/ >> common.py", line 142, in _is_valid_path >> urlresolvers.resolve(path) >> File "/opt/local/lib/python2.5/site-packages/django/core/ >> urlresolvers.py", line 246, in resolve >> return get_resolver(urlconf).resolve(path) >> File "/opt/local/lib/python2.5/site-packages/django/core/ >> urlresolvers.py", line 179, in resolve >> for pattern in self.urlconf_module.urlpatterns: >> File "/opt/local/lib/python2.5/site-packages/django/core/ >> urlresolvers.py", line 198, in _get_urlconf_module >> self._urlconf_module = __import__(self.urlconf_name, {}, {}, >> ['']) >> File "/home/johnyb/rowires/urls.py", line 16, in <module> >> (r'^admin/(.*)', admin.site.root), >> NameError: name 'admin' is not defined >> >> And here is my myapp.wsgi: >> >> import sys >> import os >> >> sys.stdout = sys.stderr >> >> sys.path.insert(0, '/home/johnyb/') >> >> import django.core.handlers.wsgi >> os.environ['DJANGO_SETTINGS_MODULE'] = 'rowires.settings' >> os.environ['PYTHON_EGG_CACHE'] = '/home/johnyb/.python-eggs' >> application = django.core.handlers.wsgi.WSGIHandler() >> >> >> I'm running out of ideas what to do, i tested a few hours without any >> luck. >> > > Apache runs as a special user, if that user doesn't have read access > to all files, and search access to directories then you will have > problems. > > http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User > > Thus, fix your permissions, or alternately if using WSGIDaemonProcess > specify user/group options to that directive as described in mod_wsgi > documentation such that Django runs as you. If that is done, the only > things that need to be accessible to Apache are directories down to > where .wsgi file is placed and the .wsgi file itself.
The other problem may simply be that you have add all required paths to sys.path. Read the Django documentation on mod_wsgi site. http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango Note how it talks about adding parent directory of project, and the project directory itself, to sys.path. The latter is required if you haven't referenced all modules via site name, which for that URL rule you haven't. 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 -~----------~----~----~----~------~----~------~--~---
