我正在将一个项目迁移到docker上的python,以便为开发提供更好的“设施”。这是一个使用python 2.7,Django 1.6.8和几个RPC依赖项运行的项目
我发现自己发现了这个堆栈跟踪的应用程序崩溃,我找不到丢失的模块(没有名为coros的模块)。
我认为它应该是与不好的版本相关的成瘾问题,或者是在默认骨骼上安装但不在docker骨骼上安装的成瘾问题。您有任何想法或建议来纠正这个问题吗?
我的Dockerfile
FROM python:2
WORKDIR /var/www
RUN echo "deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/ ./" >> /etc/apt/sources.list
RUN wget https://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/Release.key -O- | apt-key add
RUN apt-get update
RUN apt-get install libzmq3-dev libev-dev -y
RUN apt-get install -y bash \
git \
default-libmysqlclient-dev \
libldap2-dev \
libsasl2-dev \
libssl-dev \
python-gevent \
python-gevent-websocket \
build-essential \
python-dev \
locales
RUN pip install django-debug-toolbar==1.2.1
RUN apt-get install libevent-dev -y
RUN apt-get install python-all-dev -y
RUN pip install gevent
RUN pip install greenlet
RUN pip install --upgrade pip
ADD requirements.txt ./
RUN pip install -r requirements.txt
RUN pip install pyzmq
我的要求文件
crispy-forms-foundation==0.2.3.1
django-crispy-forms==1.3.2
Django==1.6.8
django-auth-ldap==1.1.4
django-pipeline==1.3.14
iso8601==0.1.8
MySQL-python==1.2.5
nameko==2.1.2
python-ldap==2.4.10
python-memcached==1.53
pytz==2013.8
django-widget-tweaks==1.3
Babel==1.3
django-braces==1.2.2
PyReact==0.2.0
raven==3.2.1
djangorestframework==3.1.3
django-statsd-mozilla==0.3.12
boto==2.8.0
libthumbor==1.0.1
Pillow==2.5.1
django-debug-toolbar==1.2.2
South==1.0.1
zerorpc==0.4.4
requests>=2.7.0,<3.0.0
python-updict==0.1.2
graphene==0.10.2
beautifulsoup4==4.5.1
ciso8601==1.0.2
错误回溯
app_1 | Traceback (most recent call last):
app_1 | File "/usr/local/lib/python2.7/wsgiref/handlers.py", line 85, in run
app_1 | self.result = application(self.environ, self.start_response)
app_1 | File "/usr/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
app_1 | return self.application(environ, start_response)
app_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
app_1 | self.load_middleware()
app_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 45, in load_middleware
app_1 | mw_class = import_by_path(middleware_path)
app_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 26, in import_by_path
app_1 | sys.exc_info()[2])
app_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 21, in import_by_path
app_1 | module = import_module(module_path)
app_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
app_1 | __import__(name)
app_1 | File "/var/www/ofsdashboards/common/middleware/login_required.py", line 7, in <module>
app_1 | compile(reverse('ofsdashboards.account.views.login').lstrip('/')),
app_1 | File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 536, in reverse
app_1 | return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
app_1 | File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 403, in _reverse_with_prefix
app_1 | self._populate()
app_1 | File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 267, in _populate
app_1 | for pattern in reversed(self.url_patterns):
app_1 | File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 365, in url_patterns
app_1 | patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
app_1 | File "/usr/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 360, in urlconf_module
app_1 | self._urlconf_module = import_module(self.urlconf_name)
app_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
app_1 | __import__(name)
app_1 | File "/var/www/ofsdashboards/urls.py", line 33, in <module>
app_1 | url(r'^homes/', include('ofsdashboards.homes.urls')),
app_1 | File "/usr/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 26, in include
app_1 | urlconf_module = import_module(urlconf_module)
app_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
app_1 | __import__(name)
app_1 | File "/var/www/ofsdashboards/homes/urls.py", line 5, in <module>
app_1 | from .dashboard import views as dashboard_views
app_1 | File "/var/www/ofsdashboards/homes/dashboard/views.py", line 17, in <module>
app_1 | from ofsdashboards.common.react_renderer import render
app_1 | File "/var/www/ofsdashboards/common/react_renderer.py", line 2, in <module>
app_1 | import zerorpc
app_1 | File "/usr/local/lib/python2.7/site-packages/zerorpc/__init__.py", line 28, in <module>
app_1 | from .socket import *
app_1 | File "/usr/local/lib/python2.7/site-packages/zerorpc/socket.py", line 27, in <module>
app_1 | from .events import Events
app_1 | File "/usr/local/lib/python2.7/site-packages/zerorpc/events.py", line 31, in <module>
app_1 | import gevent.coros
app_1 | ImproperlyConfigured: Error importing module ofsdashboards.common.middleware.login_required: "No module named coros"
追溯显示zerorpc
0.4.4试图进口gevent.coreos
,was removed in gevent 1.2。
最后,您希望将zerorpc
升级到不尝试导入gevent.coreos
的较新版本,但这可能需要进一步的依赖/代码更改。
一个更小的变化是尝试安装gevent<1.2
而不是。