没有名为 'django' uWSGI 的模块
No module named 'django' uWSGI
简而言之,当我尝试根据找到的示例测试我的安装时,我从 uWSGI 收到以下错误消息 here:
$ uwsgi --socket 127.0.0.1:3031 --chdir /home/user/~Env/proj0/proj0 --wsgi-file wsgi.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191
*** Starting uWSGI 2.0.15 (64bit) on [Wed May 31 14:10:35 2017] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-11) on 30 May 2017 20:50:53
os: Linux-3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017
nodename: echo.com
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /home/user/~Env
detected binary path: /usr/local/bin/uwsgi
chdir() to /home/user/~Env/proj0/proj0
your processes number limit is 4096
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3
Python version: 3.6.1 (default, May 29 2017, 14:21:37) [GCC 4.8.5 20150623
(Red Hat 4.8.5-11)]
Python main interpreter initialized at 0x1639580
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 415360 bytes (405 KB) for 8 cores
*** Operational MODE: preforking+threaded ***
Traceback (most recent call last):
File "wsgi.py", line 12, in <module>
from django.core.wsgi import get_wsgi_application
ModuleNotFoundError: No module named 'django'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 20065)
spawned uWSGI worker 1 (pid: 20066, cores: 2)
spawned uWSGI worker 2 (pid: 20067, cores: 2)
spawned uWSGI worker 3 (pid: 20068, cores: 2)
spawned uWSGI worker 4 (pid: 20069, cores: 2)
*** Stats server enabled on 127.0.0.1:9191 fd: 15 ***
很明显它找到了我的 wsgi.py 文件,但没有找到 Django。我不确定我是否搞砸了安装 uWSGI 系统、我的 virtualenv 文件夹布局或其他什么。我本来想尽快部署我的应用程序,但这是优先考虑的,因为我想使用 nginx 和 uWSGI。我的目录结构:
~Env---
projectenv proj0
bin proj0
include __init__.py
libs __pycache__
. settings.py
urls.py
views.py
wsgi.py
此时任何帮助都将非常有用。谢谢
它看起来不像是在使用安装了 Django 的 Python 解释器,所以它可能没有看到您的 virtualenv。
您是否采取了适当的步骤将您的 virtualenv 添加到 uwsgi 选项?
https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html#virtualenvs
简而言之,当我尝试根据找到的示例测试我的安装时,我从 uWSGI 收到以下错误消息 here:
$ uwsgi --socket 127.0.0.1:3031 --chdir /home/user/~Env/proj0/proj0 --wsgi-file wsgi.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191
*** Starting uWSGI 2.0.15 (64bit) on [Wed May 31 14:10:35 2017] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-11) on 30 May 2017 20:50:53
os: Linux-3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017
nodename: echo.com
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /home/user/~Env
detected binary path: /usr/local/bin/uwsgi
chdir() to /home/user/~Env/proj0/proj0
your processes number limit is 4096
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3
Python version: 3.6.1 (default, May 29 2017, 14:21:37) [GCC 4.8.5 20150623
(Red Hat 4.8.5-11)]
Python main interpreter initialized at 0x1639580
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 415360 bytes (405 KB) for 8 cores
*** Operational MODE: preforking+threaded ***
Traceback (most recent call last):
File "wsgi.py", line 12, in <module>
from django.core.wsgi import get_wsgi_application
ModuleNotFoundError: No module named 'django'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 20065)
spawned uWSGI worker 1 (pid: 20066, cores: 2)
spawned uWSGI worker 2 (pid: 20067, cores: 2)
spawned uWSGI worker 3 (pid: 20068, cores: 2)
spawned uWSGI worker 4 (pid: 20069, cores: 2)
*** Stats server enabled on 127.0.0.1:9191 fd: 15 ***
很明显它找到了我的 wsgi.py 文件,但没有找到 Django。我不确定我是否搞砸了安装 uWSGI 系统、我的 virtualenv 文件夹布局或其他什么。我本来想尽快部署我的应用程序,但这是优先考虑的,因为我想使用 nginx 和 uWSGI。我的目录结构:
~Env---
projectenv proj0
bin proj0
include __init__.py
libs __pycache__
. settings.py
urls.py
views.py
wsgi.py
此时任何帮助都将非常有用。谢谢
它看起来不像是在使用安装了 Django 的 Python 解释器,所以它可能没有看到您的 virtualenv。
您是否采取了适当的步骤将您的 virtualenv 添加到 uwsgi 选项?
https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html#virtualenvs