st4lk / django-solid-i18n-urls

[DEPRECATED] Use default language for urls without language prefix.
http://www.lexev.org/en/
Other
112 stars 29 forks source link

AttributeError: 'SolidLocaleRegexURLResolver' object has no attribute 'prefix_default_language' #40

Open jorenham opened 7 years ago

jorenham commented 7 years ago

After upgrading from Django 1.9.12 to 1.10.5, my project won't run anymore with the traceback:

Internal Server Error: /
Traceback (most recent call last):
  File "/home/joren/workspace/myproject/lib/python3.4/site-packages/django/core/handlers/base.py", line 131, in get_response
    response = middleware_method(request, response)
  File "/home/joren/workspace/myproject/lib/python3.4/site-packages/django/middleware/locale.py", line 36, in process_response
    i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
  File "/home/joren/workspace/myproject/lib/python3.4/functools.py", line 448, in wrapper
    result = user_function(*args, **kwds)
  File "/home/joren/workspace/myproject/lib/python3.4/site-packages/django/conf/urls/i18n.py", line 31, in is_language_prefix_patterns_used
    return True, url_pattern.prefix_default_language
AttributeError: 'SolidLocaleRegexURLResolver' object has no attribute 'prefix_default_language'
[31/Jan/2017 13:03:57] "GET / HTTP/1.1" 500 82666

I'm using the setting SOLID_I18N_USE_REDIRECTS = True and it all seems to work fine at Django 1.9.12. What's going on here?

st4lk commented 7 years ago

Hi Jorem, thanks for catching that! Looks like a bug, will try to discover in more details soon.

st4lk commented 7 years ago

Fixed possibly related issue and uploaded new version v1.4.1. But very likely you faced this exception because you have

'django.middleware.locale.LocaleMiddleware'

In the list of your MIDDLEWARE_CLASSES. If you want to use this package, you must remove it. Also, check deprecation notice.