Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 16, 2005 16:55:46

A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python, MEDIA_*, frustration


I think I'm missing something fundamental here because this setup just
isn't working.

*deep breath*

I'm getting these errors:
TemplateSyntaxError: Template 'poll_base' cannot be extended, because
it doesn't exist

And no amount of path wrangling can seem to fix it. It can seem to find
the project okay, but not the templates. Where should django be looking
for the templates if not in the specified TEMPLATE_DIRS list? Does this
change when using mod_python and I need to add something to apache? Are
my MEDIA_whatevers pointing at the correct places? My structure is
below

dirs:
# project root
/home/alice/.../pass1/

# template root
/home/alice/.../django_templates/pass1/

# contains symlink to admin media and project templates
/home/alice/.../media/
admin_media
->/home/alice/.../django/django_src/django/contrib/admin/media/

/home/alice/.../media/
pass1 -> /home/alice/.../django_templates/pass1/


vars:
# Absolute path to the directory that holds media.
MEDIA_ROOT = '/home/alice/.../media/pass1/'

# URL that handles the media served from MEDIA_ROOT.
MEDIA_URL = 'http://localhost/media/'

TEMPLATE_DIRS = (
"/home/alice/.../django_templates/pass1",
"/home/alice/.../media/pass1",
)

apache conf:
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE pass1.settings
PythonDebug On
PythonPath " + sys.path"
</Location>
<Location "/media/">
SetHandler None
</Location>
<LocationMatch "\.(jpg|gif|png)$">
SetHandler None
</LocationMatch>
MaxRequestsPerChild 1


Sorry for the long post, but can anyone spot why I'm getting these
'template doesn't exist' errors and point in a direction for me to fix
it? It's all pretty much straight from the docs.

Any help would be greatly appreciated. This aspect is being to suck :P

Alice

Offline

#2 Nov. 16, 2005 17:06:04

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python, MEDIA_*, frustration


On 11/16/05, Alice <> wrote:
> I'm getting these errors:
> TemplateSyntaxError: Template 'poll_base' cannot be extended, because
> it doesn't exist
>
> And no amount of path wrangling can seem to fix it. It can seem to find
> the project okay, but not the templates.

If your TEMPLATE_DIRS is set to this...

TEMPLATE_DIRS =

...then it's looking for the files
/home/alice/.../django_templates/pass1/poll_base.html or
/home/alice/.../media/pass1/poll_base.html, in that order.

Does one of those files exist?

Also, I assume the "..." means you've cut some of it out for brevity.
You don't want a "..." in your actual TEMPLATE_DIRS setting, because
that has special meaning in filesystem paths.

> Where should django be looking
> for the templates if not in the specified TEMPLATE_DIRS list?

It looks in the specified TEMPLATE_DIRS.

> Does this change when using mod_python and I need to add something
> to apache?

The only thing that changes is that the Apache user (the user Apache
runs under) needs permission to read your templates.

> Are my MEDIA_whatevers pointing at the correct places?

MEDIA_ROOT and MEDIA_URL are mainly used by FileFields, so Django
knows where to put uploaded files. They're not relevant in this
particular problem.

Hope this helps!

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#3 Nov. 16, 2005 17:23:07

A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_python, MEDIA_*, frustration


"The only thing that changes is that the Apache user (the user Apache
runs under) needs permission to read your templates."

...

oh. my kingdom for some nicer error messages. This problem has tripped
me up before but not on django. It was the permissions: for some reason
they all have a mixture of permissions. poll_base was 600 - didnt even
have user execute.

it's always the most mundane problems...

thanks for the help.

Alice

Offline

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support