pythondjangodjango-staticfiles

ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path


I am new to Django.

When I use the command python manage.py collectstatic, I get this error

django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path

But I can successfully run the server .

My static files declarations are:

STATIC_ROOT = ''

STATIC_URL = '/static/'

STATICFILES_DIRS = (    
    ('assets', os.path.join(PROJECT_DIR, '../static')),
)

and debug is set to true

DEBUG = True

How can I fix this? Else am missing any installation packages ?


Solution

  • Try this,

    PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
    STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
    

    Look at https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-STATIC_ROOT