Re: Flatpages not working on Apache+mod_python

2007-05-16 Thread Nimrod A. Abing

On 5/17/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
> On 5/16/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
> > Already done, though under-documented.
> > http://www.djangoproject.com/documentation/templates/#django-contrib-markup
>
> Ah, here, too:
> http://www.djangoproject.com/documentation/add_ons/#markup

Thanks for all the pointers. I am incorporating them into my app now :)
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Flatpages not working on Apache+mod_python

2007-05-16 Thread Jeremy Dunck

On 5/16/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
> Already done, though under-documented.
> http://www.djangoproject.com/documentation/templates/#django-contrib-markup

Ah, here, too:
http://www.djangoproject.com/documentation/add_ons/#markup

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Flatpages not working on Apache+mod_python

2007-05-16 Thread Jeremy Dunck

On 5/16/07, Nimrod A. Abing <[EMAIL PROTECTED]> wrote:
...
> I am using middleware as described in the docs. I don't see how to use
> flatpages as a view in the docs. How do you do that?

As the last entry in your urlpatterns, include this:
(r'^(.*)/$','django.contrib.flatpages.views.flatpage'),

> Also how does one
> inject custom Context variables when rendering flatpages?

Flatpages render using RequestContext, so you'd use a template context
processor:
http://www.djangoproject.com/documentation/settings/#template-context-processors
http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext

> As for using textile, I am planning on creating a filter for it. But
> if someone has already done so already please point the way.

Already done, though under-documented.
http://www.djangoproject.com/documentation/templates/#django-contrib-markup

Add this to INSTALLED_APPS:
'django.contrib.markup'

And in your templates, do this:

{% load markup %}
{{ yourvar|textile }}

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Flatpages not working on Apache+mod_python

2007-05-16 Thread Nimrod A. Abing

On 5/17/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
> On 5/16/07, Nimrod A. Abing <[EMAIL PROTECTED]> wrote:
> > Can anyone here provide pointers on how to get flatpages to work
> > properly under Apache and mod_python?
>
> From your custom 404, you'll want to return
> django.http.HttpResponseNotFound rather that HttpResponse.

Ah, that fixed it! Thanks! Also fixed my custom 500 handler to return
HttpResponseServerError.

> Also, are you using flatpage middleware or view?

I am using middleware as described in the docs. I don't see how to use
flatpages as a view in the docs. How do you do that? Also how does one
inject custom Context variables when rendering flatpages?

As for using textile, I am planning on creating a filter for it. But
if someone has already done so already please point the way.

Thanks.
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Flatpages not working on Apache+mod_python

2007-05-16 Thread Jeremy Dunck

On 5/16/07, Nimrod A. Abing <[EMAIL PROTECTED]> wrote:
> Can anyone here provide pointers on how to get flatpages to work
> properly under Apache and mod_python?

>From your custom 404, you'll want to return
django.http.HttpResponseNotFound rather that HttpResponse.

Also, are you using flatpage middleware or view?
What's your root urlconf module and settings.MIDDLEWARE_CLASSES look like?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Flatpages not working on Apache+mod_python

2007-05-16 Thread Nimrod A. Abing

Hello,

I am using Django 0.96 and I am currently having problems getting
flatpages middleware to work under Apache with mod_python. I am pretty
sure this is mod_python related since flatpages work fine using the
development server.

I have found at least one thread the mentions this problem, it's from
Aug 2006. The OP said he would take a look to see what the problem was
but did not post a follow-up.

http://groups.google.com/group/django-users/browse_thread/thread/eddadaacfc34aef9/194ee9abebecf6b6?lnk=gst&q=flatpages&rnum=5

The gist of it is that instead of rendering the flatpage it just keeps
rendering the 404 page when I run it on the production server.
However, using the development server flatpages work as expected. If
it helps any, I also have handler404 and handler500 point to a custom
handler.

below is the custom handler404:

def page_not_found(request):
c = getDefaultContext(request)
t = loader.get_template('404.thtml')
return HttpResponse(t.render(c))

Note I am using .thtml extension for templates only because Eclipse
with WTP chokes when editing Django templates.

getDefaultContext() above sets up the Context object containing
important variables used in the templates.

Can anyone here provide pointers on how to get flatpages to work
properly under Apache and mod_python?

One other thing... Is it possible to use Textile for flatpages too?

http://cheeseshop.python.org/pypi/textile

Thanks in advance.
--
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---