【发布时间】:2020-07-12 19:51:04
【问题描述】:
我需要刷新我的静态文件文件夹中的 js 文件,但是每当我运行 python manage.py collectstatic 时,我的静态文件文件夹的克隆会在项目的不同部分创建,并且 js 文件仍然没有更新。我尝试将 settings.py 文件中的 STATIC_ROOT 变量更改为我的静态文件夹的实际位置,但它似乎没有刷新,因为控制台中的 collectstatic 警告消息说它将被保存在一个完全不同的位置。
我的项目结构是
resume_V6-test
-resume
-home
-static (actual location)
-resume
-settings.py
-store
-staticfiles (clone of the static folder)
-users
我的 settings.py 是
# Commented out the location it was before I tried fixing the error
#STATICFILES_DIRS = [
#os.path.join(BASE_DIR, "static"),
#'/resume_V6-test/resume/home/static',
#]
#STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_ROOT = os.path.join(BASE_DIR, 'home/static')
STATIC_URL = '/static/'
错误信息是
python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings:
C:\resume_V6-test\resume\staticfiles
This will overwrite existing files!
Are you sure you want to do this?
谢谢
【问题讨论】: