从我的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]
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)
真的很感谢您的任何意见或建议-谢谢!
答案 0 :(得分:0)
可能的解释:
在OS X上,默认值为不区分大小写的文件系统。
在Ubuntu上,几乎可以肯定您拥有区分大小写的文件系统。
您是否在不区分大小写的文件系统上使用与Supervisord
相同的名为supervisord
的文件,但在不区分大小写的文件系统上使用该文件?