postgresql - Django only serves index page, 404 on all others -


i have simple django app im trying throw on digital ocean. have configured nginx proxy port , serve static files. however, when click on link go page, 404s on me. serves index page correctly, else 404.

if of back-end wizards have other do's/don't's i'm doing, feel free add in response.

i'm new nginx please dumb down :) thanks.

server {     listen 80 default_server;     listen [::]:80 default_server ipv6only=on;      root /usr/share/nginx/html;     index index.html index.htm;      # make site accessible http://localhost/     server_name localhost;      location /static {             alias /home/rchampin/ryan_the_developer_django/static;     }      location / {              # first attempt serve request file,              # directory, fall displaying 404.              try_files $uri $uri/ =404;              proxy_set_header x-real-ip  $remote_addr;              proxy_set_header x-forwarded-for $remote_addr;              proxy_set_header host $host;              proxy_pass http://127.0.0.1:8080;              # uncomment enable naxsi on location              # include /etc/nginx/naxsi.rules     }  } 

you've explicitly instructed nginx return 404 on non file requests. don't need this. django can manage error 404s. need add 404.html in template directory , django have page shown when there's 404 not found error.

plus don't need hard code index page, what's point of using django. michał karzyński has documentation on how setup nginx django:

setting django nginx, gunicorn, virtualenv, supervisor , postgresql


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -