Completely new to coding, sorry for the simple questions. I'm getting this attribute error when running python manage.py collectstatic
. I'm editing settings.py
. I have Django 1.5.1 and Python 2.7.5. Any help is appreciated and thanks in advance (again).
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 61, in isabs
return s.startswith('/')
AttributeError: 'tuple' object has no attribute 'startswith'
Now, of course I've never messed with posixpath.py
.
here's the contents of settings.py
(minus db info and such):
MEDIA_ROOT = "os.path.join(os.path.dirname(os.path.dirname(__file___))", "static", "media"
MEDIA_URL = '/media/'
STATIC_ROOT = "os.path.join(os.path.dirname(os.path.dirname(__file__))", "static", "static-only"
STATIC_URL = '/static/'
STATICFILES_DIRS = (
"os.path.join(os.path.dirname(os.path.dirname(__file__))", "static", "static",
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
SECRET_KEY = 'xxxxxxxxx'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'mvp_landing.urls'
WSGI_APPLICATION = 'mvp_landing.wsgi.application'
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(os.path.dirname(__file__)), "static", "templates",
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'south',
'join',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
You do it wrong. You shouldn't turn your code in quotes. Watch here how it should be
It should be like:
STATICFILES_DIRS = (
os.path.join(os.path.dirname(__file__), "static")
)
Also it belongs to your MEDIA_ROOT
and STATIC_ROOT
settings.