Last active
August 29, 2015 14:23
-
-
Save evansd/4a696b94d4056e8a11e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from whitenoise import WhiteNoise | |
| class WhiteNoiseIndex(WhiteNoise): | |
| index_file = 'index.html' | |
| def add_files(self, *args, **kwargs): | |
| super(WhiteNoiseIndex, self).add_files(*args, **kwargs) | |
| index_urls = [url for url in self.files.keys() if url.endswith('/' + self.index_file)] | |
| for url in index_urls: | |
| new_url = url[:-len(self.index_file)] | |
| self.files[new_url] = self.files[url] | |
| def find_file(self, url): | |
| if url.endswith('/'): | |
| url = url + self.index_file | |
| return super(WhiteNoiseIndex, self).find_file(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment