Debuggin django log on NGINX - DigitalOcean

900 Views Asked by At

I have a Django application (droplet) on DigitalOcean but I have an issue showing information in a table.

Everything works on my local server but when I deploy to the server on DigitalOcean I don't know where I can see the activity of the server like print outputs. I can see the gunicorn and nginx logs but none of those logs show the Django activity.

What should I do?

1

There are 1 best solutions below

2
On

Create your Log directory

mkdir logs in your-app directory

To get your django requests and error log; you'd have to create your indicate the log directory in your nginx server config file.

/etc/nginx/sites-available/your-app-config:

server {
...
access_log /directory/to/your-app/logs/access.log;
error_log /directory/to/your-app/logs/error.log;
...

}

Ensure you have a symbolic link to the sites-enabled folder:

sudo ln -s /etc/nginx/sites-available/your-app /etc/nginx/sites-enabled/your-app

Check that your configuration settings are okay

sudo nginx -t

Reload Nginx

sudo systemctl reload nginx

Check your log files to read requests & error logs