Images not displaying when I switch to Debug=False

I switched to Debug=False in my Django project and set the ALLOWED_HOSTS to ''. When I load my page, none of the images are displayed (they are within the media subfolder). The CSS from my static folder displays fine.

I would appreciate any insight into the issue here. Error log is below.

2014-10-03 22:57:00,396 :Internal Server Error: /art/ Traceback (most recent call last): File "/home/mccall114/.virtualenvs/rango/lib/python2.7/site-packages/django/core/handlers/", line 92, in get_response response = middleware_method(request) File "/home/mccall114/.virtualenvs/rango/lib/python2.7/site-packages/django/middleware/", line 57, in process_request host = request.get_host() File "/home/mccall114/.virtualenvs/rango/lib/python2.7/site-packages/django/http/", line 72, in get_host "Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): %s" % host) SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS):

Do you need to set up a static files mapping for the MEDIA_URL / MEDIA_ROOT, as well as the STATIC_URL/STATIC_ROOT settings?

Do you mean within my file or in pythonanywhere's Web tab?

I just added to the Web tab a mapping from /media/ to /home/mccall114/art/media, but it still isn't working.

I'm not sure what I changed but it appears to be working now. Thanks for your help.


same is the case with me.... my css and all static files are working fine... but images are not showing i have set the media root is well.

plz help.

We have a guide here, maybe it helps?

Thank's harry for the answer.

actually now everything is working images are coming through but its just because i turned debugging to True if i turned debugging to False then again images are not working???

can you help me out....!

Did you follow the guide here? ?


I had the same problem but the solution above worked for me.

In your web tab, you need to map /media/ to /home/yourusername/yourprojectname/media/

Hope this helps :)