- February 27, 2007
- Pre .96
- 0 (after 2 ratings)
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.
1 2 3 4
nullFile = lambda r: HttpResponse() # As you might've figured out, you use it in urls.py with: # (r'myRegex', 'some.module.nullFile'),
More like this
- codigo alto nivel by MrRocklion 1 month ago
- Load template from specific app by Krzysiek555 1 month, 3 weeks ago
- PostgreSQL JSON subqueries by dolamroth 1 month, 3 weeks ago
- "Magic Link" Management Command by webology 6 months, 4 weeks ago
- Closest ORM models to a latitude/longitude point by simonw 6 months, 4 weeks ago