Welcome! Log In Create A New Profile

Advanced

location settings for Django Uwsgi Nginx Configuration for production

September 15, 2017 08:29AM
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

django
Subject Author Posted

location settings for Django Uwsgi Nginx Configuration for production

sandyman September 15, 2017 08:29AM

Re: location settings for Django Uwsgi Nginx Configuration for production

itpp2012 September 15, 2017 08:38AM

Re: location settings for Django Uwsgi Nginx Configuration for production

sandyman September 15, 2017 09:43AM

Re: location settings for Django Uwsgi Nginx Configuration for production

itpp2012 September 15, 2017 01:44PM

Re: location settings for Django Uwsgi Nginx Configuration for production

Francis Daly September 16, 2017 06:46AM

Re: location settings for Django Uwsgi Nginx Configuration for production

sandyman September 17, 2017 09:16AM

Re: location settings for Django Uwsgi Nginx Configuration for production

sandyman September 17, 2017 10:49AM

Re: location settings for Django Uwsgi Nginx Configuration for production

Francis Daly September 17, 2017 01:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

dvp
Guests: 192
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready