change from throwing a Http404 exception, which I believe will try to render a static 404.html template - and ironically triggers a 500 server error. Just create a HttpResponse and set the status_code to 404.
This commit is contained in:
@@ -21,7 +21,9 @@ class StaticContentServer(object):
|
||||
try:
|
||||
content = contentstore().find(loc)
|
||||
except NotFoundError:
|
||||
raise Http404
|
||||
response = HttpResponse()
|
||||
response.status_code = 404
|
||||
return response
|
||||
|
||||
# since we fetched it from DB, let's cache it going forward
|
||||
set_cached_content(content)
|
||||
|
||||
Reference in New Issue
Block a user