-3

Hi everyone I am trying to upload a application using Nginx, Gunicorn, Django application run fine in development environment but for production it does not serves static files. I tried hard but failed to find any solution so I am posting here.Here is my NGINX configuration

Nginx

Here is my settings.py

Settings.py

Here are the results of running python manage.py collectstatic no problem all static files are collected properly

static files

Here are all the templates and html files those I am using

base

some more

base 2

more html html

Here is the full directory structure of my project

structure

why Nginx is not accessing 'root' directory when I am collecting all static files into it. it accesses 'static' directory and throws following errors in the error log

exception

why it is not accessing root directory that is suppose to have permissions for access

2
  • 2
    Replace screenshots with formatted source code, at least the nginx configuration and settings.py snippet. Show the namei -l /home/husrat/KHSSYSTEMFINAL/KHSSystemProject command output (add it to your question). Your nginx configuration won't work as-is even if you'll fix the permission issues. What user/group nginx worker processes are running from? Commented 2 days ago
  • Don't serve your static files from home dir. There is a /var/www/ dir for that and default config for nginx should be able to access files there. Commented 2 days ago

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.