Python Forum

Full Version: location settings for Django Uwsgi Nginx Configuration for production
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Django settings

STATICFILES_DIRS = [STATIC_DIR, ]
STATIC_DIR = os.path.join(BASE_DIR, 'static')
STATIC_ROOT = '/home/sandyman/production/django_project/assets/'
STATIC_URL = '/assets/'

local machine example file

/home/sandyman/development/django_project/css/bootstrap.min.css
Template

{% load staticfiles %}
href="{% static "css/bootstrap.min.css" %}"
Production environment

ran python manage.py collectstatic

this succesfully created all files in sub directories of

**/home/sandyman/production/django_project/assets/**

e.g. /home/sandyman/production/django_project/assets/css/bootstrap.min.css


** NGING configuration


**server {
server_name sandyman.xyz www.sandyman.xyz ;
location /static {
alias /home/sandyman/production/django_project/assets/;
}
}**
** GET Request **

Request URL:http://www.sandyman.xyz/static/css/bootstrap.min.css
Request Method:GET
**Status Code:404 NOT FOUND**

file bootstrap is located in

/home/sandyman/production/django_project/assets/css/bootstrap.min.css
Please assist me .. Ive tried many iterations of values for nginx location but no success