I am completely new to Pythonanywhere, I cant figure out why static files are not loading... Here is the path where I stored css and images stuff,
i.e. static/images/wikiLang.png
etc
/static/admin/ /usr/local/lib/python2.7/dist-packages/django/contrib/admin/media
/static/ /home/saadfast/WikiWorld/static
/media/ /home/saadfast/WikiWorld/media
where as in the client side how should I use the URL?
what i have done in the search.html
:
<div id="TopheaderImg">
<img src="/home/saadfast/WikiWorld/static/images/wikiLogo.png" width="100px" style="float:middle"/>
<br />
<img src="/home/saadfast/WikiWorld/images/wikipediaLang.png" width="100px" style="float:middle"/>
</div>
why the image is not loading? what should the path or URL?
PythonAnywhere dev here: I think the problem is in the paths you're using in your HTML. The mapping
/static/ /home/saadfast/WikiWorld/static
Means that URLs with /static/
at the start will be looked for in the directory /home/saadfast/WikiWorld/static
. So that means that where you have
<img src="/home/saadfast/WikiWorld/static/images/wikiLogo.png" width="100px" style="float:middle"/>
You should probably have
<img src="/static/images/wikiLogo.png" width="100px" style="float:middle"/>
There is now a PythonAnywhere wiki page about static files under Django
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With