I have written a set of Django apps that works on my development machine but fails when I deploy it to Apache. The issue appears to be with the Python path that the Apache process is using, but none of the things I have tried have worked. I'm looking for suggestions as to what I am doing wrong.
I have a Django project called lingshare. There are two applications in this project: phonemechart and search. I am hosting this project on a shared hosting provider with Apache and follwing the instructions here: http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache. The directory layout on my Apache machine looks like this: /somepath/web-interface lingshare.fcgi /somepath/web-interface/templates /somepath/web-interface/lingshare __init__.py, manage.py, settings.py, urls.py phonemechart search The phonemechart and search directories contain my Django applications. They contain __init__.py, admin.py, models.py, etc. files. When I try to access my phonemechart application (http://myserver/ somewebpath/lingshare/phonemechart) I get a generic "Unhandled Exception" page. When I look in the Apache log I see that the problem is that the models file for this application is not being loaded. ... self._urlconf_module = import_module(self.urlconf_name) File "/opt/python-2.6/lib/python2.6/site-packages/django/utils/ importlib.py", line 35, in import_module __import__(name) File "/projects/lingshare/web-interface/lingshare/phonemechart/ urls.py", line 3, in <module> from phonemechart.models import * ImportError: No module named phonemechart.models The phonemechart directory contains a models.py file. The same code works fine when I run it locally on my development machine. My lingshare.fcgi file looks like this: #!/opt/python-2.6/bin/python2.6 import sys, os # Add a custom python path. sys.path.insert(0, "/somepath/web-interface/lingshare") # Set the DJANGO_SETTINGS_MODULE environment variable. os.environ['DJANGO_SETTINGS_MODULE'] = "lingshare.settings" # Set the egg cache to somewhere the web server can write to os.environ['PYTHON_EGG_CACHE'] = '/tmp' from django.core.servers.fastcgi import runfastcgi runfastcgi(method="threaded", daemonize="false") I have also tried the following Python path line: sys.path.insert(0, "/somepath/web-interface") I get the same error. The search application works. I think this is because it is a toy app that does not try to call "import search.models". Questions: 1. What should my sys.path.insert line look like? 2. Are there other configuration details I'm overlooking? This is Django version 1.1. Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---