502 bad gateway on fresh install (ubuntu and debian)

18 views
Skip to first unread message

François Noah

unread,
Jul 17, 2024, 3:29:10 AM (10 days ago) Jul 17
to OpenWISP
I tried branch origin/22.05' and master

i got error below 
on uwsgi.log

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
    response = self.get_response(request)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 130, in get_response
    response = self._middleware_chain(request)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 49, in inner
    response = response_for_exception(request, exc)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 114, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 153, in handle_uncaught_exception
    return callback(request)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/views/defaults.py", line 88, in server_error
    template = loader.get_template(template_name)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/template/loader.py", line 15, in get_template
    return engine.get_template(template_name)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/template/backends/django.py", line 34, in get_template
    return Template(self.engine.get_template(template_name), self)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/template/engine.py", line 143, in get_template
    template, origin = self.find_template(template_name)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/template/engine.py", line 123, in find_template
    for loader in self.template_loaders:
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/template/engine.py", line 98, in template_loaders
    return self.get_template_loaders(self.loaders)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/template/engine.py", line 103, in get_template_loaders
    loader = self.find_template_loader(template_loader)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/template/engine.py", line 115, in find_template_loader
    loader_class = import_string(loader)
  File "/opt/openwisp2/env/lib/python3.10/site-packages/django/utils/module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'apptemplates'
[pid: 15660|app: 0|req: 26/26] 192.168.1.35 () {46 vars in 850 bytes} [Wed Jul 17 07:15:54 2024] GET /admin/login/?next=/admin/ => generated 0 bytes in 49 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 1)

and on nginx.log
2024/07/17 07:15:54 [error] 16848#16848: *35 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.35, server: 192.168.1.90, request: "GET /admin/login/?next=/admin/ HTTP/1.1", upstream: "uwsgi://unix:///opt/openwisp2/uwsgi.sock:", host: "192.168.1.90"

someone know how to solve it ?

regard

franck

François Noah

unread,
Jul 17, 2024, 3:30:42 AM (10 days ago) Jul 17
to OpenWISP
I used ansible-openwisp2

François Noah

unread,
Jul 17, 2024, 5:32:35 AM (10 days ago) Jul 17
to OpenWISP
I finaly solved it
it's come from wrong config param on my playbook
i removed param below

     # in case you need to add python instructions to the django settings file
    #openwisp2_extra_django_settings_instructions:
    #    - TEMPLATES[0]['OPTIONS']['loaders'].insert(0, 'apptemplates.Loader')
    # extra URL settings for django
    # openwisp2_extra_urls:
    #   - "path(r'', include('my_custom_app.urls'))"
    # allows to specify imports that are used in the websocket routes, eg:
Reply all
Reply to author
Forward
0 new messages