uWSGI + Docker:在$ PATH中找不到可执行文件pyuwsgi:

我有一个运行在我想用来提供Django应用程序的Docker容器中的uwsgi服务。 当我在本地运行uwsgi服务时,一切正常,但从docker容器我得到消息*** no app loaded. going in full dynamic mode *** *** no app loaded. going in full dynamic mode ***--- no python application found, check your startup logs for errors ---和Django的应用程序显示内部服务器错误。 这是我的uwsgi.ini文件。 在docker集装箱内,我正在用supervisord启动uwsgi,像[program:uwsgi] command = /usr/local/bin/uwsgi --ini /home/docker/code/uwsgi.ini:docker

 [uwsgi] # this config will be loaded if nothing specific is specified # load base config from below ini = :base [dev] ini = :base # socket (uwsgi) is not the same as http, nor http-socket socket = :8001 [local] ini = :base http = :8000 # set the virtual env to use home=/Users/Robbie/.virtualenvs/my_virtualenv [docker] init = :base logto = /var/logs/uwsgi.log http = :80 master = true processes = 6 [base] # chdir to the folder of this config file, plus app/website chdir = %ddjango_project_root_dir/ module=project_app.wsgi:application # Set settings module. env = DJANGO_SETTINGS_MODULE=project_app.settings chmod-socket=664 

据我可以告诉我所有的path应该是正确的…我的文件在docker集装箱简化树就像

 /home/docker/code | |____ uwsgi.ini |____ supervisor.conf | └── django_project_root_dir │ └── project_app ├── __init__.py ├── settings.py └── wsgi.py 

编辑

当我运行docker exec DOCKER_ID uwsgi --ini /home/docker/code/uwsgi.ini:local我得到的响应docker-exec: failed to exec: exec: "pyuwsgi": executable file not found in $PATH

原来我很笨。

uwsgi.ini [docker] uwsgi.ini [docker]部分需要有ini = :base ,not init = :base 。 基础部分没有被parsing,所以wsgi模块从未被设置。

总是校对你的工作,朋友。