【问题标题】:uWSGI + Docker: pyuwsgi: executable file not found in $PATHuWSGI + Docker:pyuwsgi:$PATH 中找不到可执行文件
【发布时间】:2015-02-24 06:55:31
【问题描述】:

我有一个在 Docker 容器中运行的 uwsgi 服务,我想用它来为 django 应用程序提供服务。当我在本地运行 uwsgi 服务时,一切正常,但是从 docker 容器中我收到消息 *** 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

据我所知,我的所有路径都应该是正确的......我在 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

【问题讨论】:

    标签: python django docker uwsgi


    【解决方案1】:

    原来我很笨。

    uwsgi.ini[docker] 部分需要有ini = :base,而不是init = :base。基本部分没有被解析,所以 wsgi 模块永远不会被设置。

    朋友们,一定要校对你的工作。

    【讨论】:

      猜你喜欢
      • 2017-04-28
      • 1970-01-01
      • 2018-08-10
      • 2019-01-16
      • 2015-01-25
      • 2015-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多