简体   繁体   中英

PythonAnywhere image not found

Before anyone deletes this due to the question being similar to others: Neither other questions nor the documentation got my site to work as intended.

The goal: Load images on my site

The problem: Image not found

Additional info: It works locally using python manage.py runserver

What I've done to try to fix it:

  • I've tried to follow the staticfiles guide https://help.pythonanywhere.com/pages/DjangoStaticFiles but this didn't work because I'm not using the default uploaded files handling.

  • I've tried to enter it under the PythonAnywhere > Web > static files tab but haven't been able to get that to work.

  • Tried a bunch of different solutions from the PythonAnywhere forum and SO forum and none got my site to work.

The site: http://nasablogdeployment.eu.pythonanywhere.com/

All code available here: https://github.com/MarkdenToom/NASA-blog

Static files directories here: https://imgur.com/xL0RN8A

WSGI file content: https://imgur.com/dJY4knp

Your web app is looking for the picture in http://nasablogdeployment.eu.pythonanywhere.com/blog/media/thumbnails/Touchdown_Expedition_62_Returns_to_Earth_Completes_Station_Mission.jpg while your current mapping resolves into url like that: http://nasablogdeployment.eu.pythonanywhere.com/media/thumbnails/Touchdown_Expedition_62_Returns_to_Earth_Completes_Station_Mission.jpg

Change your static files mapping so the /blog/media/ points to /home/nasablogdeployment/NASA-blog/blog/media/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM