Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
In case taht anyone comes across this in the future, I could suggest following the steps from this tutorial here:
Mainly the ‘Adjusting the Project Settings’ step which goes over the static files configuration. As well as the ‘Configure Nginx to Proxy Pass’, so you could make sure that the Nginx configuration is also correct.
Best,
Bobby
If your Django project on Nginx + uWSGI is not serving static files correctly, despite collectstatic successfully collecting them, the issue is most likely related to Nginx’s configuration, file permissions, or how static files are referenced in your project. Here’s a systematic approach to resolving the problem:
After running python manage.py collectstatic, verify the files are in the correct directory specified by STATIC_ROOT in your settings.py. For example:
STATIC_ROOT = "/var/www/html/static/"
STATIC_URL = "/static/"
Check the directory:
ls /var/www/html/static/
Ensure your Nginx configuration properly points to the STATIC_ROOT directory. Open your Nginx configuration file (e.g., /etc/nginx/sites-available/your_project) and confirm the following:
server {
listen 80;
server_name yourdomain.com;
location /static/ {
alias /var/www/html/static/;
}
location /media/ {
alias /var/www/html/media/;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/path/to/your_project/your_project.sock;
}
}
/var/www/html/static/ with your actual STATIC_ROOT directory.sudo systemctl restart nginx
Ensure Nginx has permission to read the static files directory. Check the ownership and permissions:
sudo chown -R www-data:www-data /var/www/html/static/
sudo chmod -R 755 /var/www/html/static/
http://yourdomain.com/static/css/style.css.Check the Nginx error logs for clues:
sudo tail -f /var/log/nginx/error.log
Look for:
Check your templates to ensure static files are referenced correctly using Django’s {% static %} template tag. For example:
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
If {% static %} is not resolving correctly:
django.contrib.staticfiles is in your INSTALLED_APPS.settings.py:from django.templatetags.static import static
location /static/ block is misconfigured.alias path to match your STATIC_ROOT.www-data) cannot access files.sudo chown -R www-data:www-data /var/www/html/static/
sudo chmod -R 755 /var/www/html/static/