I have few sites on a DigitalOcean.com machine and all the sites more or less have same configurations. But as I added a new site it is giving me 500 internal error. Following is the file:
upstream startup_server {
server 127.0.0.1:9888 fail_timeout=0;
}
server {
listen 80;
listen [::]:80;
root /home/django/startup;
index index.html index.htm;
client_max_body_size 4G;
server_name pitchstartupidea.com www.pitchstartupidea.com;
keepalive_timeout 5;
location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff2|woff|ttf)$ {
expires 365d;
}
# Your Django project's media files - amend as required
location /media {
alias /home/django/startup/media/;
}
# your Django project's static files - amend as required
location static/static-only {
alias /home/django/startup/static-only/;
}
# Django static images
location /static/images {
alias /home/django/startup/static/static-only/images/;
}
# Proxy the static assests for the Django Admin panel
location /static/admin {
alias /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://startup_server;
proxy_connect_timeout 60s;
}
}
I have my venv located at /home/django/startup
and my project is pys at /home/django/startup/pys
. Can someone please give me a clue what I might be doing wrong? Currently I am just trying to make it work for pre-production env with "gunicorn --bind pitchyourstartup.com:9888 pys.wsgi:application. Django settings file has ALLOWED_HOST = ['pitchyourstartup.com', 'www.pitchyourstartup.com']
and DEBUG = False
. I am getting this error while I am trying to access it with pitchyourstartup.com:9888/admin
from the browser on my local machine.
I have no clue if this is related but it was giving me a warning about middleware classes as I set it with MIDDLEWARE but in 1.8.15 it works with MIDDLEWARE_CLASSES. I fixed this and it worked. I can access it with pitchyourstartup.com:9888/admin.