Created
February 2, 2014 01:27
-
-
Save adamghill/8761762 to your computer and use it in GitHub Desktop.
Serve static files from Django. This is bad for performance and you shouldn't do it and blah, blah, blah.
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 os import path | |
from django.conf import settings | |
DOCUMENT_ROOT = path.dirname(path.realpath(__file__)) | |
urlpatterns += patterns('', | |
url(r'^robots\.txt$', 'django.views.static.serve', { | |
'path': settings.STATIC_URL + 'robots.txt', | |
'document_root': DOCUMENT_ROOT, | |
}), | |
url(r'^favicon\.ico$', 'django.views.static.serve', { | |
'path': settings.STATIC_URL + 'img/apple-touch-icon.png', | |
'document_root': DOCUMENT_ROOT, | |
}), | |
url(r'(?P<path>^apple-touch-icon(-\d{2,3}x\d{2,3})?(-precomposed)?\.png$)', 'django.views.static.serve', { | |
'path': settings.STATIC_URL + 'img/apple-touch-icon.png', | |
'document_root': DOCUMENT_ROOT, | |
}), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment