I've deployed a django webiste in AWS ec2 with the help of this digitalocean blog but the static files like css and javascripts are not loading after deployment.
This is my django static code:
STATIC_URL = '/static/'
MEDIA_URL = 'media/'
MEDIA_ROOT = 'media/'
STATIC_ROOT = 'staticfiles/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
and this is my nginx code:
server {
listen 80;
server_name mydomain.com;
location = /favicon.ico { access_log off; log_not_found off; }
location /staticfiles/ {
root /home/sammy/project/myproject;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
And I'm using AWS S3 to host my static files.