[英]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.