python - Do not internationalize/translate URLs -


problem

i'm trying upgrade django 1.10.3 django 1.9.8. tests failing however, because reason django trying translate/internationalize urls when reverse() them.

i've not changed when comes internationalization , turn "feature" off. not failing lot of tests, there projects have refer urls of website statically. means url on website not allowed change (or have edit them every translation django comes with, real pain).


error

the actual error i'm encountering in tests following:

traceback (most recent call last):   file "/tests/unit/views/test_index.py", line 14, in setup     self.url = reverse('indexpage')   file "/local/lib/python2.7/site-packages/django/urls/base.py", line 91, in reverse     return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))   file "/local/lib/python2.7/site-packages/django/urls/resolvers.py", line 346, in _reverse_with_prefix     possibilities = self.reverse_dict.getlist(lookup_view)   file "/local/lib/python2.7/site-packages/django/urls/resolvers.py", line 243, in reverse_dict     return self._reverse_dict[language_code] keyerror: 'nl-nl' 

it's obvious django trying language code provided in settings project.


what have tried

i have tried setting use_i18n setting false. have tried use_l10n. tried removing language_code specified in settings, error thrown refers en-us language code instead of nl-nl language code. tried installing localemiddleware see if @ least error stop showing, unfortunately didn't work.


question

how can turn off url internalization/translation in django. or alternative if not possible?

thanks in advance.

it may red herring (caused different error). had work through several different exceptions being throw when urls.py files loaded before error went away. try dropping django shell , running these commands:

from django.urls import reverse reverse('indexpage') 

and should see real error causing problem there. fix problem , repeat until have no more exceptions.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -