uWSGI使用Python 2.7而不是3.5,这会导致重大错误

问题描述 投票:2回答:1

我正在尝试使用django-websocket-redis pip包在Raspberry Pi 2上使用WebSockets创建一个Django应用程序。 /manage.py runserver似乎不起作用(虽然它是由/ws/中的WEBSOCKET_URL = '/ws/'设置的,但仍然有404调用settings.py),我想尝试像described here in the official docs这样的独立uWSGI服务器。

当我运行uwsig时,我遇到了奇怪的错误。我认为这是由错误的python版本引起的。 uwsig的输出显示我使用的是Python 2.7:

Python version: 2.7.13 (default, Jan 19 2017, 14:48:08)  [GCC 6.3.0 20170124]

但我的项目需要Python 3(正好是3.5)。我更改了默认的python环境,因此python comamnd指向python 3.5而不是2.7。另外,我使用--plugin开关传递了这个版本,如下所示:

uwsgi --http :9090 --plugin=python35 --wsgi-file wsgi.py

我还使用pip3for所有pip包来确保没有使用2.x包。这似乎没有效果,因为我的脚本中断和uwsgi告诉我使用Python 2.7 ...

python django raspberry-pi python-3.5 uwsgi
1个回答
1
投票

安装这个:

sudo apt-get install uwsgi-plugin-python3
© www.soinside.com 2019 - 2024. All rights reserved.