我有一个在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容器中,我使用像[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
答案 0 :(得分:3)
原来我非常愚蠢。
[docker]
的{{1}}部分需要uwsgi.ini
,而不是ini = :base
。基本部分没有被解析,所以wsgi模块永远不会被设置。
始终校对你的工作,朋友。