django-polymorphic icon indicating copy to clipboard operation
django-polymorphic copied to clipboard

Django polymorphic breaks admin site in setups with SCRIPT_NAME

Open pbrenna opened this issue 5 years ago • 1 comments

The function get_model_perms in admin/childadmin.py can't resolve a match for the /admin/ path in setups where the wsgi parameter SCRIPT_NAME is set, because request.path seems to be prepended with the SCRIPT_NAME. An error 404 is returned instead of the admin homepage.

In my setup, using request.path_info instead works for me.

pbrenna avatar Jul 23 '20 18:07 pbrenna

I had the same issue. Worked fine on my local but when I deployed to staging I hit this issue. My site is set up to run in a non-root path. I was getting a 404 error after logging into the admin interface. Changing match = resolve(request.path) to match = resolve(request.path_info) in get_model_perms() in childadmin.py made the error go away.

TristanSmithlib avatar Aug 10 '20 20:08 TristanSmithlib