Ok, I took the last email private with Rob, and got it sorted! It
seemed that apache couldn't access any files in /home/acid2, so the
solution has been to move everything into /opt/django, so I did:

sudo mv /home/acid2/src/django_src/ /opt/django/src/
sudo rm /usr/lib/python2.4/site-packages/django
sudo ln -s /opt/django_src/django /usr/lib/python2.4/site-packages/
django

Also, I store my projects and their templates in /opt/django_projects
and /opt/django_templates, respectivly.

Quick hint that i'll pass on from Rob (that I'm sure many people know)
- settings.py contains sensitive information, so I have made this
private with:
chmod 0750 /whatever/settings.py
chown root:apache /whatever/settings.py

Now it's read/write/execute for root, and only read/execute for
apache.


Hurrah! Big thanks to Rob for helping me get this fixed!

- Oliver Charles

On Apr 18, 10:10 pm, Oliver Charles <[EMAIL PROTECTED]> wrote:
> I get...
>
> [EMAIL PROTECTED] ~]$ sudo -u apache python
> Password:
> Python 2.4.3 (#1, Mar 14 2007, 18:51:08)
> [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> 
> import django
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named django>>> import sys
> >>> sys.path
>
> ['', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/
> python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/
> python2.4/lib-dynload', '/usr/lib/python2.4/site-packages']
>
> So this is the problem I guess - apache can't access django, but I'm
> not sure why... any ideas?
>
> oggie rob: Nah, I'm not discouraged, I really like there attidue...
> linux isn't my forte though it seems!
>
> --
> Ollie
>
> On Apr 18, 10:05 pm, oggie rob <[EMAIL PROTECTED]> wrote:
>
> > What happens when you run:
> > sudo -u apache python>>> import django
> > >>> django
>
> > <module 'django' from '/usr/lib/python2.4/site-packages/django/
> > __init__.pyc'>
>
> > BTW, I use openhosting and have a few django sites running so don't be
> > discouraged!
>
> >  -rob
>
> > On Apr 18, 12:59 pm, Oliver Charles <[EMAIL PROTECTED]> wrote:
>
> > > Ok,
>
> > > I've done a ton of googling on this, and not come up with much luck.
> > > Here's my situation:
>
> > > I've just purchased a new VPS from OpenHosting for a project, and it
> > > comes with mod_python, apache2 and postgresql all setup. So I did a
> > > subversion checkout of django, and symlinked it to /usr/lib/python2.4/
> > > site-packages, which I can verify:
>
> > > [EMAIL PROTECTED] ~]$ ls -al /usr/lib/python2.4/site-packages/ | grep
> > > django
> > > lrwxrwxrwx  1 root root     33 Apr 18 14:27 django -> /home/acid2/src/
> > > django_src/django
>
> > > So that looks ok, and just to make sure, here's django_src/django:
>
> > > [EMAIL PROTECTED] ~]$ ls -al ~/src/django_src/ | grep django
> > > drwxr-xr-x 20 acid2 acid2 4096 Apr 18 14:27 django
>
> > > So, with django now symlinked to my site-packages, I tried importing
> > > it in the python shell:
>
> > > [EMAIL PROTECTED] ~]$ python
> > > Python 2.4.3 (#1, Mar 14 2007, 18:51:08)
> > > [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
> > > Type "help", "copyright", "credits" or "license" for more information.
>
> > > >>> import django
>
> > > Looks good! So I now went to add this into my Apache config:
>
> > > <Location "/">
> > >         SetHandler python-program
> > >         PythonHandler django.core.handlers.modpython
> > >         #SetEnv DJANGO_SETTINGS_MODULE trainspotted.settings
> > >         PythonDebug On
> > >         PythonPath "sys.path"
> > > </Location>
>
> > > Of course, now when I go to my apache site I get:
>
> > > Mod_python error: "PythonHandler django.core.handlers.modpython"
>
> > > Traceback (most recent call last):
> > >     ....
>
> > > ImportError: No module named django
>
> > > I can't see for the life of me why this is happening. Django is
> > > readable everywhere, python can import is from the shell, and sys.path
> > > contains a django directory, with __init__.py...
>
> > > Can anyone see why I can't get the import to work? I'm banging my head
> > > on this one!
>
> > > ---
> > > Oliver Charles


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to