why collectstatic won't copy my static files?

前端 未结 7 1901
野的像风
野的像风 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-05 10:34

    just do this and make the naming convention same

    STATIC_URL = '/static/'
    STATICFILES_DIRS = [
        os.path.join(BASE_DIR, 'static')
    ]
    STATIC_ROOT = os.path.join(BASE_DIR, 'assets')
    

    static directory contains all off your project assets

    assets directory will create automatic when u run this cmd

    python3 manage.py collectstatic
    

    this will copy all static folder content into assets folder

    hope this helps :)

提交回复
热议问题