Side note. Please do not post images of code here. Copy/paste the code into the body of your post, between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```.
Do you have more details about the specific 403 error being thrown? What is the complete response being returned by the server? What about the server logs?
There are many things that can throw a 403. Knowing which specific 403 is being issued is important to know what the solution would be…
You may want to log these environment variables to verify that they’re what you’re expecting them to be.
Thanks for the reply. I figured out the issue was being raised by the AWS loadbalancer where it was directly blocking requests made to the django admin portal. This might be useful to document but I found a way around to fix it.
So my application was hosted on aws with a loadbalancer in the front. It had a rule group that disallowed any direct attempts to hit the admin url because of which I kept getting the 403 forbidden page.
I was able to resolve it by updating the rule group to add some exception sets where access to the admin pages from a fixed set of ip/region based addresses are allowed. Hope this helps!