Я пытаюсь запустить мое django приложение с docker -композицией. Но я получаю следующее
web_1 | [2020-05-01 22:49:12 +0000] [1] [INFO] Starting gunicorn 19.7.1
web_1 | [2020-05-01 22:49:12 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
web_1 | [2020-05-01 22:49:12 +0000] [1] [INFO] Using worker: sync
web_1 | [2020-05-01 22:49:12 +0000] [8] [INFO] Booting worker with pid: 8
web_1 | [2020-05-01 22:49:13 +0000] [8] [ERROR] Exception in worker process
web_1 | Traceback (most recent call last):
web_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
web_1 | worker.init_process()
web_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
web_1 | self.load_wsgi()
web_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
web_1 | self.wsgi = self.app.wsgi()
web_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
web_1 | self.callable = self.load()
web_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
web_1 | return self.load_wsgiapp()
web_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
web_1 | return util.import_app(self.app_uri)
web_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 352, in import_app
web_1 | __import__(module)
web_1 | File "/code/mysite/wsgi.py", line 7, in <module>
web_1 | application = get_wsgi_application()
web_1 | File "/usr/local/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
web_1 | django.setup(set_prefix=False)
web_1 | File "/usr/local/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
web_1 | apps.populate(settings.INSTALLED_APPS)
web_1 | File "/usr/local/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
web_1 | app_config = AppConfig.create(entry)
web_1 | File "/usr/local/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
web_1 | module = import_module(entry)
web_1 | File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
web_1 | return _bootstrap._gcd_import(name[level:], package, level)
web_1 | ModuleNotFoundError: No module named 'flaggit'
web_1 | [2020-05-01 22:49:13 +0000] [8] [INFO] Worker exiting (pid: 8)
web_1 | [2020-05-01 22:49:13 +0000] [1] [INFO] Shutting down: Master
web_1 | [2020-05-01 22:49:13 +0000] [1] [INFO] Reason: Worker failed to boot.
Я поддерживаю разветвление библиотеки на https://github.com/morenoh149/django-flaggit/releases/tag/v0.1.0 Я могу установить ее в локальной разработке, выполнив
$ pipenv install
Мой Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
django-flaggit = {git = "https://github.com/morenoh149/django-flaggit.git", editable = true, ref = "v0.1.0"}
...
[dev-packages]
black = "==18.9b0"
psycopg2-binary = "*"
[requires]
python_version = "3.7"
[pipenv]
allow_prereleases = true
Мой Pipfile.lock в этом gist
Мой docker -compose.yml равен
version: '3'
services:
db:
image: postgis/postgis
environment:
- "POSTGRES_HOST_AUTH_METHOD=trust"
volumes:
- postgres_data:/var/lib/postgresql/data/
web:
build: .
command: gunicorn mysite.wsgi -b 0.0.0.0:8000
environment:
- ENVIRONMENT=development
- DEVELOPMENT=True
- SECRET_KEY=asdfasdf12341234
- DEBUG=1
- DATABASE_URL=postgres://postgres:password@db:5432/postgres
volumes:
- .:/code
ports:
- 7000:7000
depends_on:
- db
volumes:
postgres_data:
Dockerfile
FROM python:3.7
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
WORKDIR /code
COPY Pipfile Pipfile.lock /code/
RUN pip install pipenv && pipenv install --system --verbose
COPY . ./code/
Может ли pipenv установить python пакет вилок из GitHub при работе с docker?