Forums

Templates not loading + Pinax + Pythonanywhere

I have followed these instructions: https://help.pythonanywhere.com/pages/DjangoAdminCSSNotWorking/

Inside username/webapps --> my static settings is:

url: /static/ path: /home/dalchemist/mysite2/mysite2/site_media/static

This is my project/mysite/ folder's structure. This shows all static files have been collected successfully in site_media folder.

─fixtures
─mysite
├───site_media
│ └───static
│ ├───css
│ ├───fonts
│ ├───js
│ └───pinax
│ ├───css
│ └───js
└───templates
─static
├───dist
│ ├───css
│ ├───fonts
│ └───js
└───src
├───js
└───less

I am also able to access: http://username.pythonanywhere.com/static/css/site.css , http://username.pythonanywhere.com/static/admin/img/icon_searchbox.png

But still templates are not loading

Content of the template folder: _account_bar.html
_footer.html
_scripts.html
_styles.html
homepage.html
site_base.html

Please help.

The links in your html are incorrect for the static file layout that you have. In your example, you can access http://dalchemist.pythonanywhere.com/static/css/site.css, but the URL on your page is going to http://dalchemist.pythonanywhere.com/site_media/static/css/site.css and that's why the resources are not loading.

Thanks, Glenn. Got it working.

Did you use NPM to generate the custom CSS and JS? I'm struggling with that on a project. npm is getting an error when I try to use "npm run build:js". It also complains my node.js is outdated.

Never mind. This HELP post fixed it by installing the latest Node.js and npm:

https://help.pythonanywhere.com/pages/Node

Excellent, glad you worked it out!