On Monday, July 29, 2019 at 1:43:55 AM UTC-7, Jonsubs wrote: > > Hi everyone, > Any suggestions, please? > It does work for me in locally (127.0.0.0), but not in PythonAnywhere. > Thanks, Jon. > > On Mon, Jul 22, 2019 at 4:02 PM Jon Subscripted <jonsubsc...@gmail.com > <javascript:>> wrote: > >> Hi everyone, >> I'm experiencing some problems trying to display static images in my >> static html files. Actually I get a 404 error, when I "inspect" what's >> going wrong. >> >> Some of the HTML files in my project are fully static (stored along with >> 403.html, 404.html, 500.html & 503.html) and display images stored in >> static/images folder. So I tried to link them the traditional way. (I >> assumed the URL builder cannot be used as the HTMLs are not processed by >> web2py before being served.) >> >> But it is not working. How should I link those images? >> >> I've tried different approaches but neither of them seems to work. >> >> a) relative path <img src="./images/forks_es3.png" /> (relative inside >> the app) >> b) relative path >> >> <img src="myapp/static/images/forks_es2.png" /> (relative inside the >> web2py site) >> >> c) absolute path <img src=" >> https://www.myweb.com.eus/myapp/static/images/forks_es.png" /> >> >> BTW, it may be important to note that I'm using the "routes.py" using the >> "parameter-based system" using: >> >> BASE = dict(default_application='myapp') >> >> Thanks, Jon. >> >
On my server, the following works for both links: <head> </head> <body> <img src="images/my-logo.png"> <img src="/app2/static/images/my-logo.png"> </body> My global routes.py sets (using the "simple router" example) routers = dict( # base router BASE=dict(default_application='appOne', root_static = ['favicon.ico, 'robots.txt']) and I used "app2/static/test-ess.html" to load the page. I also copied the html to appOne (already had the same logo in static images), and "static/test-ess.html" worked there; both copies of the logo were displayed. If you have a lot of static files, or some of them are large, you may want to see if you can serve them with your front-end. I have a vague idea that PythonAnywhere uses Nginx, but I don't know if they give you any control of it. /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/8f4c309d-afb7-4ba7-83a5-85a98bbe72e0%40googlegroups.com.