user3383301 user3383301 - 1 month ago 7
Python Question

Unable to perform collectstatic

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 ?

Answer

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

Comments