Django non-static content not rendering

5/10/2020

I'm using kubernetes and containers. nginx ingress controller. Also nginx container is serving up static content. The landing page (static) works just fine (checked with incognito, no caching). Soon as I go to a page that requires rendering something from the backend, it times out.

I logged into the containers and cannot see any immediate issues in the log files or elsewhere. I shut down all the containers and started them fresh. Still nothing from the Django side is responding.

Here is my nginx config (in Kubernetes/yaml format):

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-config
data:
  nginx.conf: |
    events {
      worker_connections  1024;
    }
    http {
      server {
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
        listen 8080;
        server_name localhost;

        location ^~ /.well-known/acme-challenge/ {
          default_type "text/plain";
        }

        location /static/ {
          autoindex on;    
          alias /code/core/static/; 
          include /etc/nginx/mime.types;
        }

        location = /favicon.ico {
        access_log off;
        log_not_found off;
        }

        location / {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_pass http://127.0.0.1:8080/;
        }
      }
    }

I can't tell what the issue is. Any ideas on how to troubleshoot?

-- J. Brett Cunningham
django
kubernetes
nginx
nginx-ingress

0 Answers