I was caught by surprise when I moved my stuff to a production server,
too.  The live pythonpath is clearly different than you're expecting,
which I'm sure you know already.

My ultimate problem was that I was taking advantage of the fact that
Django's development server puts your project on the pythonpath
environment variable.  Apache does not.  So even once you get it
successfully running, things won't work properly sometimes, because
the various files in my project were omitting the project name when I
was trying to do imports.  I had to go back and add my project name in
as part of my imports ("from myapp.models import *" -> "from
myproject.myapp.models import *").

This may or may not be the exact problem, but when I look at your
pythonpath and glanced at Brad's link he pasted, I noticed that the
contents of your projects is on the path, but not the parent directory
of the project.  You may need an extra "__init__.py" in the parent
directory, too.

It all got really confusing, especially when I was trying to deploy
multiple Django sites.

Is any of that relevant to your problem?  I'm not exactly an expert,
but I know that I got harassed by this type of issue, too.

Tim

On Nov 24, 12:43 pm, "philip.bar...@impaerospace.com"
<pbar...@gmail.com> wrote:
> When I try running my project via Apache I get a "No module named
> ho.pisa" error message.
>
> However, when I run the same project from django's built-in dev
> server, it works just fine.
>
> Similarly, when I access python, or go through python manage.py shell,
> I can import ho.pisa without error.
>
> I've tried reinstalling Pisa. I've double checked that Pisa is one my
> site packages and that my site packages are in my python path.
>
> I'm using Ubuntu 9.10, Apache 2.2, Django 1.0.3 and Python 2.5
>
> Setting python 2.5 as default was done with the following steps:
> /usr/bin/python is a symlink to /usr/bin/python2.5
> /usr/share/python/debian_defaults has been edited to specify python2.5
> has my default python
> And a partial recompile of mod python
>
> I successfully got this working using a different system running
> Ubuntu 8.10, so it might be a problem with Ubuntu 9.10.
>
> Anyone have any thoughts as to what to try next?
>
> Something that might be related that I couldn't figure out was that
> the error page from Django claims that the Django version is 2.6.4,
> which it shouldn't be.
>
> Full error read out follows:
>
> ViewDoesNotExist at /nsr/wizard/
>
> Could not import idms.nsr.views. Error was: No module named ho.pisa
>
> Request Method:         GET
> Request URL:    http://localhost/nsr/wizard/
> Exception Type:         ViewDoesNotExist
> Exception Value:
>
> Could not import idms.nsr.views. Error was: No module named ho.pisa
>
> Exception Location:     /usr/lib/python2.5/site-packages/django/core/
> urlresolvers.py in _get_callback, line 133
> Python Executable:      /usr/bin/python
> Python Version:         2.6.4
> Python Path:    ['/usr/lib/python2.5/site-packages', '/home/ase/Desktop/
> idms_project', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2',
> '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/
> python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/
> python2.6/dist-packages/Numeric', '/usr/lib/python2.6/dist-packages/
> PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/
> python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/
> pymodules/python2.6/gtk-2.0', '/usr/lib/python2.6/dist-packages/wx-2.8-
> gtk2-unicode', '/usr/local/lib/python2.6/dist-packages']
> Server time:    Tue, 24 Nov 2009 21:38:28 +0000
>
> Environment:
>
> Request Method: GET
> Request URL:http://localhost/nsr/wizard/
> Django Version: 1.0.3
> Python Version: 2.6.4
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'idms.general',
>  'idms.ipl',
>  'idms.doc',
>  'idms.ssi',
>  'idms.fsr',
>  'idms.dar',
>  'idms.dmm',
>  'idms.tdm',
>  'idms.ssir',
>  'idms.nsr',
>  'idms.ssir.templatetags',
>  'idms.ffd']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.middleware.doc.XViewMiddleware',
>  'django.middleware.transaction.TransactionMiddleware')
>
> Traceback:
> File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
> in get_response
>   82.                     request.path_info)
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in
> resolve
>   183.                     sub_match = pattern.resolve(new_path)
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in
> resolve
>   183.                     sub_match = pattern.resolve(new_path)
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in
> resolve
>   124.             return self.callback, args, kwargs
> File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py" in
> _get_callback
>   133.             raise ViewDoesNotExist, "Could not import %s. Error
> was: %s" % (mod_name, str(e))
>
> Exception Type: ViewDoesNotExist at /nsr/wizard/
> Exception Value: Could not import idms.nsr.views. Error was: No module
> named ho.pisa
>
> Thank you for any help.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.


Reply via email to