[英]Docker container has different behaviour on server than local machine - uwsgi and nginx
从我的MacOS计算机运行时,我的docker容器似乎正确部署,但从远程Ubuntu 18.04服务器运行时无法导入应用程序模块。 这是一个使用uwsgi和nginx作为Web服务器的烧瓶应用程序。 确切的错误是
ImportError:没有名为'app'的模块
我已尝试过以下各种文件的不同配置,但没有任何成功。
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]
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]
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)
非常感谢任何意见或建议 - 提前感谢!
可能的解释:
在OS X上,默认值是不区分大小写的文件系统。
在Ubuntu上,您几乎肯定有一个区分大小写的文件系统。
您是否使用名为Supervisord
的文件,它与不区分大小写的文件系统上的supervisord
相同,但不区分大小写?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.