I am trying to run my django app with docker-compose. But I get the following
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.
I maintain a fork of a library at https://github.com/morenoh149/django-flaggit/releases/tag/v0.1.0 I can install it just fine in local development by doing
$ pipenv install
My Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
django-flaggit = {editable = true,git = "https://github.com/morenoh149/django-flaggit"}
...
[dev-packages]
black = "==18.9b0"
psycopg2-binary = "*"
[requires]
python_version = "3.7"
[pipenv]
allow_prereleases = true
I installed the fork in the past by running a command like
$ pipenv install -e git+https://github.com/morenoh149/django-flaggit#egg=django-flaggit
My Pipfile.lock in this gist
My docker-compose.yml is
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/
Can pipenv install python package forks from GitHub when running from docker?
Dockerfile
to the question. – Andy Shinn May 1 '20 at 22:59Pipfile.lock
as well? Is it possible you did not dopipenv lock
after adding the git package? – Andy Shinn May 2 '20 at 0:13git = "https://github.com/morenoh149/django-flaggit.git"
, usefile = "https://github.com/morenoh149/django-flaggit/tarball/v0.1.0"
– jakub May 12 '20 at 21:47django-flaggit = {file = "https://github.com/morenoh149/django-flaggit/tarball/v0.1.0", editable = true, ref = "v0.1.0"}
I get this error gist.github.com/morenoh149/0b06b466204684c9684f2abc6a410e09 – Harry Moreno May 13 '20 at 1:53