Forums

Boostrap theme is not working. Please help.

Website: https://www.earthfields.in/

Console Error:

Refused to apply style from 'https://www.earthfields.in/static/bootstrap/themes/default/css/bootstrap.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

When I open the css URL getting 404 error https://www.earthfields.in/static/bootstrap/themes/default/css/bootstrap.min.css File is present at directory location.

Code to load the boostrap css:

{% bootstrap_styles theme='default' type='min.css' %}

Its working perfectly fine when I run the website locally. Please help.

[formatted by admin]

It looks like right now you have a static file mapping from /static/ to /home/pcskull/pcskull.pythonanywhere.com/static, which looks correct. So that means that the system will look for a file for the URL https://www.earthfields.in/static/bootstrap/themes/default/css/bootstrap.min.css in /home/pcskull/pcskull.pythonanywhere.com/static/bootstrap/themes/default/css/bootstrap.min.css.

Does the file exist at that location? If not, have you run python manage.py collectstatic?

Static files are mapped to /home/pcskull/static

$ python manage.py collectstatic

You have requested to collect static files at the destination
location as specified in your settings:

/home/pcskull/static

We do have file present at "static/bootstrap/themes/default/css/"

$ pwd
/home/pcskull

$ ls static/bootstrap/themes/default/css/

bootstrap.css  bootstrap.min.css

All other static files are working except this.

[formatted by admin]

Like Giles already pointed -- your current static file mappings on your Web page are set from /static/ to /home/pcskull/pcskull.pythonanywhere.com/static, if there is no /bootstrap/ directory with expected contents under this path, that will not work.

there's an error:

your mappings map the url /static/ to the directory /home/pcskull/pcskull.pythonanywhere.com/static.

But in your message above, your files seem to be in /home/pcskull/static

If I run,

$ python manage.py collectstatic

You have requested to collect static files at the destination location as specified in your settings:

/home/pcskull/static

It is showing static directory as "/home/pcskull/static" .

How you can say that "your mappings map the url /static/ to the directory /home/pcskull/pcskull.pythonanywhere.com/static."?

check your webapp config on PythonAnywhere. in particular the static file mappings.