Django
장고, collectstatic 명령 시 STATIC_ROOT setting 에러
수알치
2021. 11. 12. 01:39
장고, collectstatic 명령 시 STATIC_ROOT setting 에러
글. 수알치 오상문
정적(static) 파일을 모아주는 python manage.py collectstatic 명령을 실행할 때 아래와 같은 에러가 나타나면
1) django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
2) The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting.
프로젝트 홈 앱 settings.py에 아래 옵션을 추가해보자.
STATIC_ROOT = '/static/' # os.path.join(BASE_DIR, 'static')
이제 다시 collectstatic 명령을 내려보자.
> python manage.py collectstatic 또는 py manage.py collectstatic
[실행 결과]
199 static files copied to 'C:\static'. <-- C 드라이브 static 폴더에 스태틱 파일이 모아졌다.
반응형