thumbtackthief thumbtackthief - 1 year ago 133
Python Question

Customize templates in a third party Django app

I'm using a third party app (django-social-share) in my Django project but I need to customize the templates. I'm not sure how to go about doing that--everything I try keeps using the default templates.

The current default template is stored in:


I've made my custom one in:


My templates setting:

'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'context_processors': [
'loaders': (

Answer Source

You can put the template in a separate app within your project. Django looks for templates in your apps in the order they are defined in INSTALLED_APPS, and uses the first match:

The order of INSTALLED_APPS is significant! For example, if you want to customize the Django admin, you might choose to override the standard admin/base_site.html template, from django.contrib.admin, with your own admin/base_site.html in myproject.polls. You must then make sure that your myproject.polls comes before django.contrib.admin in INSTALLED_APPS, otherwise django.contrib.admin’s will be loaded first and yours will be ignored. (source)

So create an app, called e.g. social_share_templates, and put it in INSTALLED_APPS before django_social_share. Then add the template to this folder:


The reason your current configuration does not work, is that your local app has the same name as the app in site-packages. If your local app is an actual python module, you won't be able to use the app in site-packages. Otherwise, Django just looks for the templates in the app in site-packages.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download