Problem with appending slash at the end of the url

34 views
Skip to first unread message

Dongwon Kang

unread,
Dec 7, 2015, 9:19:59 AM12/7/15
to Django users
Hi I'm newbie here and I just wonder if I can ask some question here.

I don't know even it's a problem, but anyway, I just updated django 1.8.7 to django 1.9 and found application isn't working.

I found out django wasn't redirecting not-slashed url. it returns 500 error if slash hadn't been at the end of the url. but it works well if it's in Debug mode.

but the most thing I suffer from is It works if a url is loaded in debug mode. for example, resolving /iidx/test returns 500, but if /iidx/test was loaded successfully in debug mode, then the url is called well even if it's release mode.

I cleared cache, *.pyc files, and did everything I can do but couldn't find out exact solution. 

urls.py is at here and project is running at here. I just want to know anything about it.

thanks for reading.

Carsten Fuchs

unread,
Dec 7, 2015, 1:10:18 PM12/7/15
to django...@googlegroups.com
Hello,

Am 07.12.2015 um 13:37 schrieb Dongwon Kang:
> I don't know even it's a problem, but anyway, I just updated django 1.8.7 to django 1.9
> and found application isn't working.
>
> I found out django wasn't redirecting not-slashed url. it returns 500 error if slash
> hadn't been at the end of the url. but it works well if it's in Debug mode.

It is the CommonMiddleware that implements a redirect from "no-slash" to "slash/" URLs,
see
<https://docs.djangoproject.com/en/1.8/ref/middleware/#module-django.middleware.common>
for details, so maybe some (other) middleware is involved that causes the trouble?

I'm mentioning this because I recently had a similar problem, where my own middleware
caused problems when another middlewere (in this case, the CommonMiddleware) interfered,
that is, replied to a request, which in turn was unexpected for my custom middleware,
causing it to fail.

> but the most thing I suffer from is It works if a url is loaded in debug mode. for
> example, resolving /iidx/test returns 500, but if /iidx/test was loaded successfully in
> debug mode, then the url is called well even if it's release mode.

Maybe you can have an email sent to you if a 500 error occurs, and/or check the error
logs of your webserver, so that you can see the stack trace to see where the error
occurs. You'll need this information in order to fix the problem.

Best regards,
Carsten
Reply all
Reply to author
Forward
0 new messages