question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash when starting: File "/usr/local/bin/daphne", line 8, in <module>

See original GitHub issue

Hi there, I updated to the newest version and not my openwisp is always crashing:

Here is a stack trace (taken with docker logs from the dashboard container):

2021-06-11 22:36:22,117 INFO Set uid to user 0 succeeded
2021-06-11 22:36:22,117 INFO Set uid to user 0 succeeded
2021-06-11 22:36:22,119 INFO supervisord started with pid 1
2021-06-11 22:36:22,119 INFO supervisord started with pid 1
2021-06-11 22:36:23,122 INFO spawned: 'daphne' with pid 11
2021-06-11 22:36:23,122 INFO spawned: 'daphne' with pid 11
2021-06-11 22:36:24,123 INFO success: daphne entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2021-06-11 22:36:24,123 INFO success: daphne entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Traceback (most recent call last):
  File "/usr/local/bin/daphne", line 8, in <module>
    sys.exit(CommandLineInterface.entrypoint())
  File "/usr/local/lib/python3.7/site-packages/daphne/cli.py", line 191, in entrypoint
    cls().run(sys.argv[1:])
  File "/usr/local/lib/python3.7/site-packages/daphne/cli.py", line 252, in run
    application = import_by_path(args.application)
  File "/usr/local/lib/python3.7/site-packages/daphne/utils.py", line 12, in import_by_path
    target = importlib.import_module(module_path)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "./openwisp/asgi.py", line 11, in <module>
    django.setup()
  File "/usr/local/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/usr/local/lib/python3.7/site-packages/django/conf/__init__.py", line 83, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python3.7/site-packages/django/conf/__init__.py", line 70, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.7/site-packages/django/conf/__init__.py", line 177, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "./openwisp/settings.py", line 36, in <module>
    f'{HTTP_SCHEME}://{os.environ["API_DOMAIN"]}',
  File "/usr/local/lib/python3.7/os.py", line 681, in __getitem__
    raise KeyError(key) from None
KeyError: 'API_DOMAIN'
2021-06-11 22:36:24,212 INFO exited: daphne (exit status 1; not expected)
2021-06-11 22:36:24,212 INFO exited: daphne (exit status 1; not expected)
2021-06-11 22:36:25,217 INFO spawned: 'daphne' with pid 14
2021-06-11 22:36:25,217 INFO spawned: 'daphne' with pid 14

It looks like a environment variable called API_DOMAIN is missing. How to I set it in the container? I am starting it with make start like in the manual.

Thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
atb00kercommented, Jun 12, 2021

I just noticed in your list of containers above that the api container is missing, if you can join the chat room on Matrix: https://app.element.io/#/room/#openwisp_dockerize-openwisp:gitter.im or Gitter: https://gitter.im/openwisp/dockerize-openwisp

Then we can quickly debug and find the problem.

0reactions
Bixiloncommented, Jun 12, 2021

Looks like it is working:

  1. Backup .env
  2. Make git pull in /opt/openwisp/docker-openwisp
  3. restore and set API_URL
  4. start
Read more comments on GitHub >

github_iconTop Results From Across the Web

CRITICAL Listen failure: [Errno 88] Socket operation on non ...
I have made a server using Django REST framework and Django channels but I am unable to configure supervisor to run with it....
Read more >
simple django channels app not running with daphne
I'm trying to get django channels running with daphne but I always ... line 8, in <module> sys.exit(CommandLineInterface.entrypoint()) File ...
Read more >
ASGI errors when deploying Django project for production ...
Hello guys, how are you doing. I have an issue I hope can find a solution from experts. I want to deploy my...
Read more >
Daphne causing Modulenotfound error on production - Async
Im trying to run daphne for websocket but its failing and throwing ... File "/home/administrator/people/peoples/venv/bin/daphne", line 8, ...
Read more >
Deploying Django Channels using Daphne - masnun.rocks()
In your settings.py file, make sure you used redis as the backend and input the ... started at system launch and restarted when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found