[英]Docker container has different behaviour on server than local machine - uwsgi and nginx
My docker container seems to deploy correctly when running it from my MacOS machine, but fails to import the app module when running from my remote Ubuntu 18.04 server. 从我的MacOS计算机运行时,我的docker容器似乎正确部署,但从远程Ubuntu 18.04服务器运行时无法导入应用程序模块。 It is a flask app that uses uwsgi and nginx as a web server.
这是一个使用uwsgi和nginx作为Web服务器的烧瓶应用程序。 Exact error is
确切的错误是
ImportError: No module named 'app'
ImportError:没有名为'app'的模块
I have tried different configurations of the various files below, without any success. 我已尝试过以下各种文件的不同配置,但没有任何成功。
Dockerfile: Dockerfile:
FROM python:3.5
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
libatlas-base-dev gfortran nginx supervisor
RUN pip3 install uwsgi
COPY requirements.txt /project/requirements.txt
RUN pip3 install -r /project/requirements.txt
RUN useradd --no-create-home nginx
RUN rm /etc/nginx/sites-enabled/default
RUN rm -r /root/.cache
COPY nginx.conf /etc/nginx/
COPY flask-site-nginx.conf /etc/nginx/conf.d/
COPY uwsgi.ini /etc/uwsgi/
COPY supervisord.conf /etc/
COPY /app /project
WORKDIR /project
CMD ["/usr/bin/supervisord"]
Supervisord: Supervisord:
[supervisord]
nodaemon=true
[program:uwsgi]
command=/usr/local/bin/uwsgi --ini /etc/uwsgi/uwsgi.ini --die-on-term
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:nginx]
command=/usr/sbin/nginx
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
uwsgi: uwsgi:
[uwsgi]
module = app.wsgi
callable = app
uid = nginx
gid = nginx
socket = /tmp/uwsgi.sock
chown-socket = nginx:nginx
chmod-socket = 664
cheaper = 1
processes = %(%k + 1)
Really appreciate any input or advice - thanks in advance! 非常感谢任何意见或建议 - 提前感谢!
Possible explanation: 可能的解释:
On OS X, the default is a case-insensitive file system. 在OS X上,默认值是不区分大小写的文件系统。
On Ubuntu, you almost certainly have a case-sensitive file system. 在Ubuntu上,您几乎肯定有一个区分大小写的文件系统。
Do you use a file called Supervisord
which is the same as supervisord
on a case-insensitive file system but not on a case-sensitive one? 您是否使用名为
Supervisord
的文件,它与不区分大小写的文件系统上的supervisord
相同,但不区分大小写?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.