django The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting

12,632

may be help this.

STATIC_URL = '/static/'
    if not DEBUG:
        STATIC_ROOT = ''
    STATICFILES_DIRS = [
        os.path.join(BASE_DIR, 'static/'),
    ]
Share:
12,632

Related videos on Youtube

Anuj TBE
Author by

Anuj TBE

I am a software engineer persuing B.Tech with Computer Science. Like to write and deploy softwares,programs and website/web programs for windows,android and many...

Updated on June 04, 2022

Comments

  • Anuj TBE
    Anuj TBE 7 months

    I'm deploying a Django application on heroku.

    In my settings module, I have configured to host static files like

    STATIC_ROOT = os.path.join(BASE_DIR, 'static_my_project')
    STATIC_URL = '/static/'
    STATICFILES_DIRS = [
        os.path.join(BASE_DIR, 'static_my_project')
    ]
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'static_cdn', 'media_root')
    

    and urls.py

    urlpatterns = urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    

    But on deployment to heroku, it gives error as

    SystemCheckError: System check identified some issues:
    ERRORS:
    ?: (staticfiles.E002) The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting.
    
    • Lemayzeur
      Lemayzeur almost 5 years
      if the static root is the same with static_dirs, no need to set it in your settings. STATICFILES_DIRS is the list of folders where Django will search for additional static files, in addition to each static folder of each app installed. STATIC_ROOT is the folder where every static files will be stored after a manage.py collectstatic

Related