Philip Busko
Philip Busko

Reputation: 11

django runserver works, but with daphne there's an error

I have a django website with channels for websockets that is working on my local machine. I can call python manage.py runserver and the site runs fine, the frontend websocket connection can send and receive from the backend server. However, when I wrap the django code in a daphne call, it throws an error:

daphne -b 0.0.0.0 backend.app_proj.asgi:application

File "c:\projects\injurycheck\v1\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS)
File "c:\projects\injurycheck\v1\lib\site-packages\django\apps\registry.py", line 91, in populate app_config = AppConfig.create(entry)
File "c:\projects\injurycheck\v1\lib\site-packages\django\apps\config.py", line 90, in create module = import_module(entry)
File "C:\Program Files\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pipeline' 

Can anyone say why the site builds correctly under runserver, but inside daphne it can't find an app that is actually included in INSTALLED_APPS?

Upvotes: 1

Views: 2177

Answers (1)

Blackdoor
Blackdoor

Reputation: 982

cd /path/to/your/project
daphne -b 0.0.0.0 app_proj.asgi:application

show my backend server with nginx command:

cd /path/to/your/project
daphne -b 127.0.0.1 -p 8080 -e ssl:8443:privateKey=/path/to/privkey.pem:certKey=/path/to/fullchain.pem app.asgi:application -v 3

Upvotes: 1

Related Questions