我在 Django 项目中使用第三方应用程序 (django-social-share),但我需要自定义模板。我不知道如何去做——我尝试的一切都继续使用默认模板。
当前默认模板存储在:
django-social-share/django_social_share/templates/django_social_share/templatetags/post_to_facebook.html.
我已经定制了一个:
{{project_root}}/{{app_name}}/templates/django_social_share/templatetags/post_to_facebook.html
我的模板设置:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
'mainsite.context_processors.google_api'
],
'loaders': (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
),
},
},
]