我的静态资产文件位于文件夹资产中,而其他静态文件位于默认文件夹中
myProject
|
myProject
| assets
| jquery
| bootstrap
| default
| css
| js
| urls.py
| settings.py
| uwsig.py
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATICFILES_DIRS = [os.path.join(BASE_DIR, PROJECT_NAME + "/" + TEMPLATE_THEME), os.path.join(BASE_DIR, PROJECT_NAME + "/assets")]
AWS_ACCESS_KEY_ID = config('AWS_ACCESS_KEY_ID', "")
AWS_SECRET_ACCESS_KEY = config('AWS_SECRET_ACCESS_KEY', "")
AWS_STORAGE_BUCKET_NAME = config('AWS_STORAGE_BUCKET_NAME', "")
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
AWS_DEFAULT_ACL = None
AWS_PRELOAD_METADATA = True
AWS_S3_OBJECT_PARAMETERS = {'CacheControl': 'max-age=86400', }
AWS_STATIC_LOCATION = 'static'
if USE_LOCAL_MEDIA:
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_URL = "/static/"
MEDIA_URL = '/media/'
else:
STATICFILES_STORAGE = 'core.overrides.storage_backends.StaticStorage'
STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, AWS_STATIC_LOCATION)
AWS_PUBLIC_MEDIA_LOCATION = 'media/public'
DEFAULT_FILE_STORAGE = 'core.overrides.storage_backends.PublicMediaStorage'
AWS_PRIVATE_MEDIA_LOCATION = 'media/secured'
PRIVATE_FILE_STORAGE = 'core.overrides.storage_backends.PrivateMediaStorage'
STATICFILES_DIRS应该收集所有静态文件,当USE_LOCAL_MEDIA为True时,这将很好地工作。但是,如果我想通过将USE_LOCAL_MEDIA设置为False来切换S3 SORAGE,然后运行“ python manage.py collectstatic”,它将收集除资产文件夹中的所有静态文件。请问我在做什么错了