Forums

Static urls of web-tab not working

Hi friends, I just signed up here a few days ago, made my mini-project locally, tested and then re-created that here in python anywhere. Everything is fine, and pythonanywhere.com is working just awesome, but the django-static problem, which I was afraid of isn't working, I had just one favicon image and meta-images to be of this, So I thought of using the web-tab, I created one folder in root directory of my project, placed the image there, and added an entry in the static fields, but that is not working, I did like this. favicon.ico - home/<MyUserName>/<projectName>/static/images/favicon.ico

Note: I am using <brackets> here just for asking, in actual I have replaced with their respective values, and there is no error in that-I have checked and rechecked

https://www.pythonanywhere.com/user/<MyUserName>/files/home/<MyUserName>/<ProjectName>/static/images/favicon.ico I verified the path by navigating here and it shows correctly

But the static path is not working, while starting up , I did that once following a tutorial to fix the css's of admin login page, but now it is not working , i have reloaded web-app using it reload server button, checked everything but don't know it is not working, kindly help

Happy to help :-)

The problem is in the path that you're entering for the "Directory" portion of the static file mapping. It should be the filesystem path for the file, not the URL that appears in your browser's location bar when you're using the "Files" page. So, for example, if you want to manage a file that you can see when you're accessing this URL from the "Files" page:

https://www.pythonanywhere.com/user/<MyUserName>/files/home/<MyUserName>/<ProjectName>/static/images/favicon.ico

...then the filesystem location would be:

/home/<MyUserName>/<ProjectName>/static/images/favicon.ico

Note the "/" at the start, and the fact that it doesn't have "/files/" in it.

Thank you very much, that's helpful, got it.

Thank you very much, that's helpful, got it.

No problem, glad to help!