【发布时间】:2014-06-30 20:39:39
【问题描述】:
我将我的最终工作项目部署到 heroku。
问题只是 html 内容加载,缺少静态文件。我尝试了很多但错过了一些东西。你能发现错误吗?
# .. settings.py
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
)
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(BASE_DIR, 'static/'),
)
STATIC_ROOT = ''
STATIC_URL = '/static/'
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates/'),
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
【问题讨论】:
标签: python django heroku django-templates