方法一:(The best way)
urlpatterns = patterns(
(r’^robots\.txt$’, TemplateView.as_view(template_name=’robots.txt’, content_type=’text/plain’)),
)
其他:
http://stackoverflow.com/questions/6867468/setting-up-mimetype-when-using-templateview-in-django
时间: 2024-10-11 09:23:28