0

I'm in the process of upgrading a django app from 1.9.10 to 1.10.5 and am finding that the URL is no longer resolving correctly because FORCE_SCRIPT_URL is set, and is being tacked onto ** everything ** now.

I suspect that this is because of "an addition in django.setup() allows URL resolving that happens outside of the request/response cycle (e.g. in management commands and standalone scripts) to take FORCE_SCRIPT_NAME into account when it is set". (https://docs.djangoproject.com/en/1.10/ref/applications/#django.setup).

If I set the FORCE_SCRIPT_URL, the site works locally on the browser, and I can login, go to different apps within this project, and they all seem to work ok for the most part. However, all of the view tests fail with a 404 error because the URLs are not resolving correctly, and all of my tests involving logging in are also failing (again, I think this is because the url is not resolving correctly). For example, previously, calling reverse(my_url_name) would return /my_path whereas now, it returns /subdomain/my_path.

Are there any work arounds or things I am missing in this upgrade to fix this issue? I'd really prefer not to unset this setting, FORCE_SCRIPT_URL, as there are many things that seem to depend on this.

Thanks in advance!

mokutsu
  • 11
  • 4

1 Answers1

0

Simple fix was to just override this setting in our testing environment, but keeping it active in the rest of our settings.

mokutsu
  • 11
  • 4