MIME type issue occurs when Django uses static files such as Js,css

Source: Internet
Author: User

Using the Adminlte template, return render (Request, ' adminlte/index.html ') reported the following error and the page rendering exception, CSS has no effect:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://127.0.0.1:8000/host/index/plugins/ Icheck/flat/blue.css ".

Error:

Reason:

Problem solved, in fact, JS file did not find, the 200 564 is deceptive, HTML file inside the path is wrong. Reference to the https://segmentfault.com/q/1010000000652054

Processing methods

Copy the static folder package from the Dist, plugins, and other errors to the static directory

Configuring in settings.py

Static_url = '/static/'
Staticfiles_dirs = (
Os.path.join (Base_dir, ' static '),
)

Then modify the relative paths of static files in index.html, such as dist and plugins, etc.

and

and

MIME type issue occurs when Django uses static files such as Js,css

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.