403 Forbidden

55 views
Skip to first unread message

sunday honesty

unread,
May 24, 2020, 11:46:47 AM5/24/20
to Django users
Trust you're doing great guys!
Please can someone help with the template name where 403 forbidden message that always displays when you raise PermissionDenied.
I want to customize the message that should display...
I have tried
403.html in my registration folder inside my templates folder but it's not working.

Kasper Laudrup

unread,
May 24, 2020, 12:59:55 PM5/24/20
to django...@googlegroups.com
Hi Sunday,
It's hard to guess what you mean by "not working", but be aware that
custom error pages are not used when Debug is set to True in your
settings. Maybe that's why it's "not working".

Kind regards,

Kasper Laudrup

sunday honesty

unread,
May 24, 2020, 1:05:52 PM5/24/20
to django...@googlegroups.com
What I mean is that it's still outputting the default " 403 forbidden" and not using any custom template.
If it's because default=True in my settings, why did my other custom template at "templates/registration/... displayed?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d096c046-a5ec-ebd8-2cd6-d2d9803cc8df%40stacktrace.dk.

Kasper Laudrup

unread,
May 24, 2020, 1:11:52 PM5/24/20
to django...@googlegroups.com
Hi Sunday,

On 24/05/2020 15.04, sunday honesty wrote:
> What I mean is that it's still outputting the default " 403 forbidden"
> and not using any custom template.
> If it's because default=True in my settings, why did my other custom
> template at "templates/registration/... displayed?
>

OK. That doesn't sound related to the "Debug=True" setting, although it
does sound weird if your other custom error pages are being shown with
Debug settings enabled?

Maybe someone else has an idea?

Kind regards,

Kasper Laudrup

sunday honesty

unread,
May 24, 2020, 1:18:58 PM5/24/20
to django...@googlegroups.com
Yes, I have both custom password_reset_email.html and password_reset_subject.txt at /registration/...

But are you sure the correct name is 403.html?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Kasper Laudrup

unread,
May 24, 2020, 2:01:18 PM5/24/20
to django...@googlegroups.com
Hi Sunday,

On 24/05/2020 15.17, sunday honesty wrote:
> Yes, I have both custom password_reset_email.html and
> password_reset_subject.txt at /registration/...
>
> But are you sure the correct name is 403.html?
>

That makes sense. You don't have custom *error* pages, but custom
registration pages. That's something different.

I've only done customization for 404 and 500 errors, but that worked
fine when adding them in my root templates dir as 404.html and 500.html
so I can only assume it would work the same for custom 403 error pages,
but I'm not sure.

I tested that the actual error pages were used by setting Debug to False
temporarily in development and then added some handlers for rendering
them specifically at /404 and /500 in development so I could use static
files etc.

Kind regards,

Kasper Laudrup
Reply all
Reply to author
Forward
0 new messages