Forums

Django App: Images display locally but not in Pythonanywhere

I just successfully deployed my app to pythonanywhere, however, neither of my 2 images are displaying. I'm trying to follow the instructions for Static files mappings, but I'm not sure I understand. In the template files the images are pointe to from the django template language, which is:

background: url({% static 'images/filename' %})

The absolute path is:/home/username/projectname/appname/static/filename

I tried entering it this way. I also tried entering the url as /stack/images/filename. But, that didn't work either. What am I missing here.

We've got a help page for debugging this issue -- take a look at the table How the static files mapping finds your file: https://help.pythonanywhere.com/pages/DebuggingStaticFiles. Also, make sure you followed all the steps required by Django -- https://help.pythonanywhere.com/pages/DjangoStaticFiles.

i am using external liks ex. (httpps://site/img.png) but i am stil getting issue

If an external img URL is not working, check the network tab in your browser's developer tools to see why it is not loading.