If you wanted to do this purely within django, you could write a  
custom middleware that reads a 'request body max size' setting from  
settings.py, then checks the content-length header on incoming request  
against that setting and returns a custom 413 if it's too large. I  
believe that doing this in process_request will allow you to catch the  
content-length header before the message body has been read (but I'd  
sure like to hear about it if that's not true).
http://www.djangoproject.com/documentation/middleware/

I don't know enough about how apache and django interact to tell you  
how to fix your current solution, sorry...

Eric


On Jul 16, 2008, at 11:18 AM, [EMAIL PROTECTED] wrote:

>
> I have used the LimitRequestBody directive in the apache conf to set
> it to 1 mb. so, any files biggers than 1 mb should be rejected.
>
> while testing it however, i found that when i try to upload a file
> larger than 1 mb, it ends up displaying my custom 500.html page..
>
> how can I display another custom error page ?
>
> i also tried with this directive in apache conf file:
>
> ErrorDocument 413 http://www.<my-host>/413error/
>
> and then defined the 413error in urls.py and tried to display a custom
> template. but no luck.
>
>
> any ideas ?
> >


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