upstream hello_server {
    server djangoapp:8000;
}

server {

    listen 80;
    server_name localhost;

    location /static/ {
        alias /opt/services/djangoapp/static/;
    }

    location /media/ {
        alias /opt/services/djangoapp/media/;
    }

    location / {
        proxy_pass http://hello_server;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
        if (!-f $request_filename) {
            proxy_pass http://hello_server;
            break;
        }
    }
}