Using a static Index page with Django and Nginx


Using a static Index page with Django and Nginx



I'm building a website using Django + Apache and Nginx to serve my static content. My site's index does not require any backend Django coding, so what would I need to change in nginx.conf to send requests for location / { } to some index.html in my static-content, while still allowing my urls.py to handle patterns appropriately?

upstream backend {    server 127.0.0.1:8080; }  server {    listen       192.168.1.20:80;    server_name  www.example.com example.com;     access_log   /home/userxyz/public_html/example.com/logs/nginx_access.log;    error_log    /home/userxyz/public_html/example.com/logs/nginx_error.log;     location /     {       proxy_pass   http://127.0.0.1:8080;       include      /etc/nginx/proxy.conf;    }     location ~ ^/(system|images|robots\.txt|css|js|favicon\.ico).*$    {       root    /home/userxyz/public_html/example.com/static-content/;    }     location /media/     {       root    /home/userxyz/public_html/example.com/;    } } 



Add row to inlines dynamically in django admin

1:



Is there a way to auto-increment a Django field with respect to a foreign key?
location = / {   root    /home/userxyz/public_html/example.com/static-content/; } 


Is there any reason why you can't compare a template filter to a string in Django template syntax?


Django linked models - available fields in admin

2:



In Django, how can I find out the request.session sessionid and use it as a variable?
What about something like:.
How would you populate a field based on another field
location ~ ^/$ {     root /PATH/TO/index.html; } 
The idea is to give nginx a rule for exactly matching '/'..
Unhandled Exception in Flup


How do I make django show empty cells with it's template system?


95 out of 100 based on 45 user ratings 695 reviews