python - django wsgi错误没有找到名为站点名称的模块

标签 python django ssl websocket wsgi

当我运行命令 uwsgi --http :8081 --gevent 100 --module websocket --gevent-monkey-patch --master -H env/ 我得到错误 No找到 python 应用程序,当我指定 wsgi.py 文件的路径时,uwsgi --http :8081 --gevent 100 --module websocket --gevent-monkey-patch -- master -H env/--wsgi-file/Users/ishansrivastava/Desktop/ChatApp/Chatire/chatire/wsgi.py`,我明白了

ModuleNotFoundError: No module named 'chatire'
DAMN ! worker 1 (pid: 77847) died :( trying respawn ...
Respawned uWSGI worker 1 (new pid: 77851)
*** running gevent loop engine [addr:0x104312c00] ***
Traceback (most recent call last):
  File "/Users/ishansrivastava/Desktop/ChatApp/env/lib/python3.6/site-packages/gevent/monkey.py", line 611, in patch_all
    patch_thread(Event=Event, _warnings=_warnings)
  File "/Users/ishansrivastava/Desktop/ChatApp/env/lib/python3.6/site-packages/gevent/monkey.py", line 348, in patch_thread
    _patch_existing_locks(threading_mod)
  File "/Users/ishansrivastava/Desktop/ChatApp/env/lib/python3.6/site-packages/gevent/monkey.py", line 263, in _patch_existing_locks
    if isinstance(o, rlock_type):
  File "/Users/ishansrivastava/Desktop/ChatApp/env/lib/python3.6/site-packages/django/utils/functional.py", line 215, in inner
    self._setup()
  File "/Users/ishansrivastava/Desktop/ChatApp/env/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "/Users/ishansrivastava/Desktop/ChatApp/env/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/Users/ishansrivastava/Desktop/ChatApp/env/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked

当我进入目录 chatire 并再次运行相同的命令时,我得到了

OSError: unable to complete websocket handshake
[pid: 79930|app: 0|req: 1/1] 127.0.0.1 () {46 vars in 789 bytes} [Wed Nov 14 16:13:37 2018] GET /475ae83b85db4d0 => generated 0 bytes in 67 msecs (HTTP/1.1 500) 0 headers in 0 bytes (1 switches on core 99)
you need to build uWSGI with SSL support to use the websocket handshake api function !!!
Traceback (most recent call last):
  File "./websocket.py", line 30, in application
    env.get('HTTP_ORIGIN', '')
OSError: unable to complete websocket handshake
[pid: 79930|app: 0|req: 2/2] 127.0.0.1 () {46 vars in 789 bytes} [Wed Nov 14 16:13:46 2018] GET /475ae83b85db4d0 => generated 0 bytes in 19 msecs (HTTP/1.1 500) 0 headers in 0 bytes (1 switches on core 99)
you need to build uWSGI with SSL support to use the websocket handshake api function !!!
Traceback (most recent call last):
  File "./websocket.py", line 30, in application
    env.get('HTTP_ORIGIN', '')
OSError: unable to complete websocket handshake
[pid: 79930|app: 0|req: 3/3] 127.0.0.1 () {46 vars in 789 bytes} [Wed Nov 14 16:13:54 2018] GET /475ae83b85db4d0 => generated 0 bytes in 25 msecs (HTTP/1.1 500) 0 headers in 0 bytes (1 switches on core 99)
^CSIGINT/SIGQUIT received...killing workers...
Brutally killing worker 1 (pid: 79930)...
Wed Nov 14 16:14:00 2018 - stopping gevent signals watchers for worker 1 (pid: 79930)...
gateway "uWSGI http 1" has been buried (pid: 79932)
Wed Nov 14 16:14:00 2018 - stopping gevent sockets watchers for worker 1 (pid: 79930)...
Wed Nov 14 16:14:00 2018 - main gevent watchers stopped for worker 1 (pid: 79930)...

最佳答案

在根文件夹中尝试这个命令:

uwsgi --http :8081 --gevent 100 --module websocket --gevent-monkey-patch --master

在根文件夹中必须有一个名为 websocket.py 的模块。

如果您使用的是 virtualenv,请确保它已激活并安装了所有依赖项。

关于python - django wsgi错误没有找到名为站点名称的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53298431/

相关文章:

python - 在Python中按值对多个字典进行排序

python - Linux中的Python和python3有不同的pip吗?

django - Google API 范围已更改

python - 合并缺少键的字典以创建组合字典

python - 如何获得当前行与前几行相比的排名

iis - 如何获得经过验证的 SSL 证书

ssl - 在购买的域名上托管 Chef Server 12

node.js - SSL 错误 : CERT_UNTRUSTED while using npm command

python - 如何使用 PyAudio 选择特定的输入设备

python - django 不提供静态文件