One thing I absolutely love about Django’s template loading

Is the ability to specify a series of template folders in [your settings file](

Here’s what we do at [work](

    os.path.join(os.path.dirname(__file__), "templates"),
    os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "ANOTHERSITE", "templates")),

It allows us to easily share templates from ANOTHERSITE with sister/sub sites, but when/if you need to override them you just drop your new template your site’s templates folder and you’re off to the races.

###Another template tip
If you use the tip above, I’d recommend putting templates that are explicity shared in a templates/shared folder.

Then you can do things like:

{% extends 'shared/shared_somethingorother.html' %}

It’s a minor tip, but it helps prevent collisions and alerts developers that these templates shouldn’t have any site specific code in them.

About Chris

Python developer, Agile practitioner trying desperately not to be a pointy haired boss.
This entry was posted in Django, Python. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s