Django 'STATIC_ROOT' url giving PermissionError

I'm running collectstatic with docker-compose and nginx. When I run the command python collectstatic, I get a Permission denied error such as this:

PermissionError: [Errno 13] Permission denied: '/project/static'

I'm trying to link it also with nginx. Trying different combinations it doesn't seem to accept my static files and this error is popping out most of the times. I tried using changing ownership with chown but it tells me I'm not allowed to change ownership, and when adding sudo in before it says sudo: not found (I'm running the scripts through a .sh script file).

This is django

STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

And this nginx configuration:

server {
    listen ${LISTEN_PORT};

    location /static {
        alias /static/;

    location / {
        uwsgi_pass              ${APP_HOST}:${APP_PORT};
        include                 /etc/nginx/uwsgi_params;
        client_max_body_size    10M;

Also changing the name of the folder in STATIC_ROOT didn't work. What am I doing wrong?

Back to Top