vintasoftware / django-react-boilerplate

Django 5, React, Bootstrap 5 with Python 3 and Webpack project boilerplate
MIT License
1.97k stars 479 forks source link

Docker compose module not found (docker and docker.wsgi) #432

Closed Buuntu closed 4 years ago

Buuntu commented 4 years ago

Describe the bug Getting a ModuleNotFoundError: docker error when trying to run docker-compose up -d on the backend.

I tried adding pip install docker to the Dockerfile but then I just get:

ModuleNotFoundError: No module named 'docker.wsgi'

To Reproduce Steps to reproduce the behavior:

  1. Install following README instructions
  2. Run docker-compose up -d
  3. Look at the logs of backend application

Expected behavior Should run on localhost:8000 like it does when running outside of docker

Desktop (please complete the following information):

Buuntu commented 4 years ago

The fix was to change the gunicorn line in backend/Dockerfile from:

CMD gunicorn docker.wsgi --log-file - -b 0.0.0.0:8000 --reload

to:

CMD gunicorn application_name.wsgi --log-file - -b 0.0.0.0:8000 --reload

Should this be in the README though?

Buuntu commented 4 years ago

A different error that I'm getting on the frontend side is:

Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 13.x
frontend_1  |     
frontend_1  |     Found bindings for the following environments:
frontend_1  |       - OS X 64-bit with Node.js 13.x
frontend_1  |     
frontend_1  |     This usually happens because your environment has changed since running `npm install`.

I've tried removing node_modules, updating the node-sass version, and adding:

RUN npm install node-sass@latest

at the end of the Dockerfile. Maybe it doesn't work with the latest version of Node and Linux?

FreelanceDev217 commented 4 years ago

The fix was to change the gunicorn line in backend/Dockerfile from:

CMD gunicorn docker.wsgi --log-file - -b 0.0.0.0:8000 --reload

to:

CMD gunicorn application_name.wsgi --log-file - -b 0.0.0.0:8000 --reload

Should this be in the README though?

Thank you. You saved my day. I believe this should be handled on creating the Django project using this template rather than mentioning it in README.md.

72L commented 4 years ago

The fix was to change the gunicorn line in backend/Dockerfile from:

CMD gunicorn docker.wsgi --log-file - -b 0.0.0.0:8000 --reload

to:

CMD gunicorn application_name.wsgi --log-file - -b 0.0.0.0:8000 --reload

Should this be in the README though?

This worked, but it is not in the README.

jhgv commented 4 years ago

PR #441 have been opened to fix it. Thanks for reporting!