For static files, and for all settings I use something like this (in settings.py):
# settings.py
import os
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
def ABS_DIR(rel):
return os.path.join(BASE_DIR, rel.replace('/', os.path.sep))
MEDIA_ROOT = ABS_DIR('project_name/site_media/')
MEDIA_URL = '/site_media/'
STATIC_ROOT = ABS_DIR('project_name/static/')
STATIC_URL = '/static/'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
STATICFILES_DIRS = (
ABS_DIR('project_static'),
)
and in urls.py (a part of it):
# urls.py
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
# for dev static files serving
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
It's tested and working. Maybe you have a problem with paths in PDF class?