我有一个要在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容器中,我以有监督者身份启动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
原来我很傻。
[docker]
有uwsgi.ini
需要的部分ini = :base
,没有init = :base
。没有解析基本部分,因此从未设置过wsgi模块。
朋友们,请务必校对您的工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句