-1

I have a Django app that I created and am trying to deploy onto Google Cloud Platform. When I try to go to the given link after running gcloud app deploy, I get a 502 Bad Gateway error. Looking at the logs, I see this error:

gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

I looked this up and from this stackoverflow post, I tried running the following command locally:

gunicorn --log-file=- onbytes.wsgi:application

However, I get the error:

ModuleNotFoundError: No module named 'onbytes'

Nothing comes up when I look this up on google. I tried running pip3 install onbytes but that failed to yield anything. Anyone know what's going on?

kbunarjo
  • 1,277
  • 2
  • 11
  • 27

2 Answers2

0

There was another error message in the log slightly above the one I was looking at:

ModuleNotFoundError: No module named 'corsheaders'

I got it to work after installing corsheaders through the command:

pip install django-cors-headers

and then adding it to the requirements.txt

pip freeze > requirements.txt
kbunarjo
  • 1,277
  • 2
  • 11
  • 27
0

Old question though. But, it seems the mistake was specifying onbytes instead of your project name. Like this.

gunicorn --log-file=- yourprojectname.wsgi:application

This is because, by default, the wsgi.py file is under the folder with your project name and application is a variable set in that file - mostly like:

import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'yourprojectname.settings')
application = get_wsgi_application()