Changes between Version 3 and Version 4 of Ticket #29068, comment 2


Ignore:
Timestamp:
Feb 3, 2018, 3:52:48 AM (7 years ago)
Author:
Gerben Morsink

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29068, comment 2

    v3 v4  
    1212With the Django testserver this works fine, but in production (Apache + WSGI) it gives a lot of seemingly strange errors, such as unexpected 404s and (after including the package silk) unexpected 500 errors. The strange thing was, that it did work on the test server (also Apache + WSGI), but not on the live server. It gave me some pulled out grey hair, so I hope someone finds this anwers when the need is there.
    1313
     14
     15
     16
     17
     18For your info, I only find out about this issue (and the fact that it lead to a lot of 404s) after I installed Silk and saw the following stacktrace:
     19
     20{{{
     21
     22[Fri Feb 02 20:42:49.035335 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] Traceback (most recent call last):
     23[Fri Feb 02 20:42:49.035375 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/urls/base.py",
     24line 77, in reverse
     25[Fri Feb 02 20:42:49.035382 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     extra, resolver = resolver.namespace_dict[ns] [Fri Feb 02 20:42:49.035392 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/urls/resolvers.py",
     26line 342, in namespace_dict
     27[Fri Feb 02 20:42:49.035398 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     return self._namespace_dict[language_code]
     28[Fri Feb 02 20:42:49.035420 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] KeyError: 'en-gb'
     29[Fri Feb 02 20:42:49.035433 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] [Fri Feb 02 20:42:49.035437 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] During handling of the above exception, another exception occurred:
     30[Fri Feb 02 20:42:49.035442 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] [Fri Feb 02 20:42:49.035450 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] Traceback (most recent call last):
     31[Fri Feb 02 20:42:49.035474 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/silk/middleware.py",
     32line 33, in silky_reverse
     33[Fri Feb 02 20:42:49.035479 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     r = reverse('silk:%s' % name, *args, **kwargs) [Fri Feb 02 20:42:49.035489 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/urls/base.py",
     34line 87, in reverse
     35[Fri Feb 02 20:42:49.035494 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     raise NoReverseMatch("%s is not a registered namespace" % key) [Fri Feb 02 20:42:49.035512 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]
     36django.urls.exceptions.NoReverseMatch: 'en-gb' is not a registered namespace [Fri Feb 02 20:42:49.035523 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] [Fri Feb 02 20:42:49.035527 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] During handling of the above exception, another exception occurred:
     37[Fri Feb 02 20:42:49.035531 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] [Fri Feb 02 20:42:49.035540 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] Traceback (most recent call last):
     38[Fri Feb 02 20:42:49.035643 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/start-overnew-with-git-version-control/backend/framework/framework/wsgi.py",
     39line 14, in <module>
     40[Fri Feb 02 20:42:49.035655 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     application =
     41get_wsgi_application()
     42[Fri Feb 02 20:42:49.035673 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/core/wsgi.py",
     43line 14, in get_wsgi_application
     44[Fri Feb 02 20:42:49.035679 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     return WSGIHandler() [Fri Feb 02 20:42:49.035688 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/core/handlers/wsgi.py",
     45line 151, in __init__
     46[Fri Feb 02 20:42:49.035694 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] self.load_middleware() [Fri Feb 02 20:42:49.035702 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/core/handlers/base.py",
     47line 56, in load_middleware
     48[Fri Feb 02 20:42:49.035708 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     mw_class =
     49import_string(middleware_path)
     50[Fri Feb 02 20:42:49.035727 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/utils/module_loading.py",
     51line 20, in import_string
     52[Fri Feb 02 20:42:49.035732 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     module =
     53import_module(module_path)
     54[Fri Feb 02 20:42:49.035741 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/usr/local/lib/python3.5/importlib/__init__.py", line 126, in import_module [Fri Feb 02 20:42:49.035746 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     return _bootstrap._gcd_import(name[level:], package, level) [Fri Feb 02 20:42:49.035755 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "<frozen importlib._bootstrap>", line 985, in _gcd_import [Fri Feb 02 20:42:49.035764 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "<frozen importlib._bootstrap>", line 968, in _find_and_load [Fri Feb 02 20:42:49.035774 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked [Fri Feb 02 20:42:49.035783 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "<frozen importlib._bootstrap>", line 673, in _load_unlocked [Fri Feb 02 20:42:49.035792 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "<frozen importlib._bootstrap_external>", line 697, in exec_module [Fri Feb 02 20:42:49.035801 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed [Fri Feb 02 20:42:49.035811 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/silk/middleware.py",
     55line 42, in <module>
     56[Fri Feb 02 20:42:49.035816 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     fpath =
     57silky_reverse('summary')
     58[Fri Feb 02 20:42:49.035825 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/silk/middleware.py",
     59line 38, in silky_reverse
     60[Fri Feb 02 20:42:49.035830 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     r = reverse(name, *args,
     61**kwargs)
     62[Fri Feb 02 20:42:49.035839 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/urls/base.py",
     63line 91, in reverse
     64[Fri Feb 02 20:42:49.035844 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args,
     65**kwargs)))
     66[Fri Feb 02 20:42:49.035858 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/urls/resolvers.py",
     67line 438, in _reverse_with_prefix
     68[Fri Feb 02 20:42:49.035863 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     possibilities =
     69self.reverse_dict.getlist(lookup_view)
     70[Fri Feb 02 20:42:49.035872 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]   File "/home/ webapps/production_v5/lib/python3.5/site-packages/django/urls/resolvers.py",
     71line 335, in reverse_dict
     72[Fri Feb 02 20:42:49.035877 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276]     return self._reverse_dict[language_code] [Fri Feb 02 20:42:49.035896 2018] [wsgi:error] [pid 169677:tid 139961307232000] [remote 127.0.0.1:48276] KeyError: 'en-gb'
     73}}}
     74
     75
Back to Top