Module ho.pis can not be found when running on apache

278 views
Skip to first unread message

pba...@gmail.com

unread,
Nov 24, 2009, 2:43:37 PM11/24/09
to Django users
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.

brad

unread,
Nov 24, 2009, 3:12:01 PM11/24/09
to Django users


On Nov 24, 1: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.
>

Well, this sounds very similar to a problem I'm having (but with
cx_Oracle, rather than ho.pisa). Are you using virtualenv?

I've described by problem here:
http://bradmontgomery.blogspot.com/2009/11/gahhh-django-virtualenv-and-cxoracle.html

Tim Valenta

unread,
Nov 24, 2009, 5:25:17 PM11/24/09
to Django users
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"

pba...@gmail.com

unread,
Nov 26, 2009, 8:17:28 AM11/26/09
to Django users
As it turned out, I hadn't managed to get mod_python to work with
Python 2.5 properly.

I found these instructions http://www.briggs.net.nz/log/2007/04/20/mod_python-and-python25/
for going from 2.4 to 2.5 and adapted them for going from 2.6 to 2.5.

After that, the python version began showing up as 2.5.4 and ho.pisa
could be found.

Brad, Tim, thank you for your input.

-Philip
Reply all
Reply to author
Forward
0 new messages