Report this

What is the reason for this report?

Bad gateway error message with Django

Posted on January 10, 2018

I’m getting a bad gateway error. (My own fault for using Youtube)

This is the Nginx error message

2018/01/10 17:07:58 [error] 2210#2210: *5 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 86.167.15.195, server: _, request: “GET / HTTP/1.1”, upstream: “http://unix:/home/django/gunicorn.socket:/”, host: “159.65.16.251” 2018/01/10 17:08:45 [error] 2210#2210: *7 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 86.167.15.195, server: _, request: “GET / HTTP/1.1”, upstream:

Looking at the other questions I changed ALLOWED_HOSTS = [ipaddress] and added ALLOWED_HOSTS += ip_addresses() top the bottom

A really dumb question do I change the secret key on the droplet to the secret key from my project?

WSGI.py

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “django_project.settings”)

application = get_wsgi_application()

URls.py

from django.conf.urls import include, url from django.contrib import admin

urlpatterns = [ url(r’^admin/‘, include(admin.site.urls)), url(r’^‘, include(‘personal.urls’)), url(r’^blog/‘, include(‘blog.urls’)), url(r’^writing/', include(‘writing.urls’)), ]

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.