简体   繁体   中英

uWSGI + Docker: pyuwsgi: executable file not found in $PATH

I have a uwsgi service running in a Docker container that I want to use to serve a django application. When I run the uwsgi service locally, everything works fine, but from the docker container I get the messages *** no app loaded. going in full dynamic mode *** *** no app loaded. going in full dynamic mode *** and --- no python application found, check your startup logs for errors --- and the django app shows an Internal Server Error. Here is my uwsgi.ini file. Inside the docker container I am starting uwsgi with supervisord like [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

As far as I can tell all of my paths should be correct... a simplified tree for my files in the docker container is like

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

EDIT

When I run docker exec DOCKER_ID uwsgi --ini /home/docker/code/uwsgi.ini:local I get the response docker-exec: failed to exec: exec: "pyuwsgi": executable file not found in $PATH

Turns out I'm pretty dumb.

[docker] section of uwsgi.ini needs to have ini = :base , not init = :base . The base section wasn't being parsed, so the wsgi module was never getting set.

Always proofread your work, friends.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM