Login

Most bookmarked snippets

Snippet List

Dynamically specify TEMPLATE_DIRS

In your site’s settings.py module (in your site root), TEMPLATE_DIRS takes absolute paths. Here is a way to dynamically determine the absolute path to the application directory so you only have to specify relative paths within settings.py. Obviously, replace “application_directory” with the name of your application’s directory.

  • configuration
Read More

Serving null files

Sometimes you have to serve null files. This quick hacky generic view lets you do that. The best example of that is robots.txt, I want my robots.txt to always be empty, at least for now. The other example would be favicon.ico, but that's more often used to actually fill a purpose.

  • null
  • files
  • views
Read More

3109 snippets posted so far.