1)对比以下两行图 理解STATIC_URL的意义
#access static files by url STATIC_URL = '/static/'
2)部署django项目的时候需要用到STATIC_ROOT ,它是收集所有的静态文件并放在一个目录里,即STATIC_ROOT指向的目录里:
#the dir for command "python manage.py collectstatic" STATIC_ROOT = os.path.join(BASE_DIR, "collect_static") #locate the common static files STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'common_static') ]
再附上一张对比图,以供参考: