File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,18 @@ def __init__(self):
4242 def adjust_response (self , response ):
4343 'Locate placeholder magic strings and replace with content'
4444
45- c1 = self ._replace (response .content ,
46- self .header_placeholder ,
47- self .embedded_holder .css )
48-
49- response .content = self ._replace (c1 ,
50- self .footer_placeholder ,
51- "\n " .join ([self .embedded_holder .config ,
52- self .embedded_holder .scripts ]))
45+ try :
46+ c1 = self ._replace (response .content ,
47+ self .header_placeholder ,
48+ self .embedded_holder .css )
49+
50+ response .content = self ._replace (c1 ,
51+ self .footer_placeholder ,
52+ "\n " .join ([self .embedded_holder .config ,
53+ self .embedded_holder .scripts ]))
54+ except AttributeError :
55+ # Catch the "FileResponse instance has no `content` attribute" error when serving media files in the Django development server.
56+ pass
5357
5458 return response
5559
You can’t perform that action at this time.
0 commit comments