views:

48

answers:

1

so here's the setting:

The whole site is working fine if I remove the application (whose name is myapp) in the INSTALLED_APPS section in the settings file I added WSGIPythonHome in apache2.conf

I can successfully access the apps via the the interactive python shell in Django (python manage.py shell). I can create, update and delete data.

I am using the standard Apache 2 setup for Ubuntu 10.04 Lucid Lynx(sites-enabled, mods-enabled, apache2.conf, etc)

I am running a virtualenv located in /home/ygamretuta/dev/myproject

My django project is located in /home/ygamretuta/dev/site1

error Log file says this (last 2 lines):

File "/home/ygamretuta/dev/myproject/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module

TemplateSyntaxError: Caught ImportError while rendering: No module named myapp

my django.wsgi contains this:

import os, sys
sys.path.append('/home/ygamretuta/dev')
os.environ['DJANGO_SETTINGS_MODULE'] = 'site1.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

my virtual host file for site1.com (contained in the sites-available folder) contains this (stripped of other details):

WSGIDaemonProcess ygamretuta processes=2 maximum-requests=500 threads=1
WSGIProcessGroup ygamretuta
WSGIScriptAlias / /home/ygamretuta/dev/site1/apache/django.wsgi

What could I have missed? I am getting e 500 Internal Server Error if the custom apps (the ones I made with manage.py startapp) are not commented out

+3  A: 

Append /home/ygamretuta/dev/site1 to sys.path.

Ignacio Vazquez-Abrams
that was already done in the django.wsgi as noted above. Must I put it anywhere else?
Ygam
No it isn't. Look again.
Ignacio Vazquez-Abrams
If I replace the current one with /site1, it will cause the error Could not import settings 'site1.settings', as noted by Google code's take on WSGI Django integration, the sys.path.append folder parameter must be the parent of the django project folder: "In other words, it should be the directory you were in when 'django-admin.py' was run. It also equates to the parent directory of the directory which contains the 'settings.py' created by 'django-admin.py startproject'."
Ygam
I never said "replace".
Ignacio Vazquez-Abrams
I also have two `sys.path.append` statements in my WSGI script.
André Caron
thank you! and sorry for the misinterpretation
Ygam