why collectstatic won't copy my static files?

前端 未结 7 1889
野的像风
野的像风 2021-02-05 10:07

I have MyApp/static/MyApp directory

When I run ./manage.py collectstatic, I expect the MyApp directory be copied to STATIC_ROOT but it doesn\'t

I have Downloaded

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 10:40

    if you have setup everything properly for static and you are using nginx then enter this command

    sudo nginx -t
    

    You will see error why your static files aren't being served and fix that specific error

    In my case I gave wrong path in my nginx config

    location /static {
            root /home/ubuntu/myproject/app/static/;
        }
    

提交回复
热议问题