When I load up the server at example.org(not actual ip) via nginx, the contents show up fine. However, the static files such as css and js doesn't show up. What needs to be changed for static files to be shown? I am just doing python manage.py runserver on nginx to check if files are being fed, but only template show up without static files.
The actual static folder(css/js/img) is at
/opt/myenv/myproject/myproject/static
I have /etc/nginx/sites-available/myproject as
server {
listen 80;
server_name example.org; ##not actual ip
access_log /var/log/nginx/example.log;
location /static/ {
alias /opt/myenv/static/;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
This is what I have for /opt/myenv/myproject/mysite/settings.py.
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')