Forums

Cannot upload images to Flask app

I have recently deployed a flask app but cannot get the static images to load correctly onto my pages.

My img tags have src="/static/path/to/imagename.svg". My static files' directory is "/home/MSAProjectISC10/flaskapp/MSA Website/assets/" and my static files' URL is simply linked to "/static".

My files are located in /home/MSAProjectISC10/flaskapp/MSA Website/assets/path/to/.

I really need help uploading them. A direct response rather than a redirect to another forum page would be nice, since I've already looked at other pages and documentations but couldn't get my thing to work.

Any answer is appreciated.

Have you see the help page on debugging static files? Could you provide the three pieces of information that are mentioned there as the place to start debugging this kind of issue:

  1. The URL which you expect to be able to load the static file from (eg www.mydomain.com/static/path/to/myfile.css)
  2. The path where this file is stored on disk, in your PythonAnywhere account(eg /home/myusername/myproject/assets/path/to/myfile.css)
  3. The relevant static files mapping from the web tab, the values for its URL and path settings (eg: URL /static/ maps to path /home/myusername/myproject/assets)