Resource interpreted as Stylesheet but transferred with MIME type text/html

Help! What am I doing wrong?

No matter what I try, I get an error saying: "Resource interpreted as Stylesheet but transferred with MIME type text/html: “

The css file is loading with a 200 OK.

I have tried running the website on Chrome, Chromium and Firefox. My final target is only Chromium.

Although the final product will be much larger, I simplified the following to eliminate other potential issues. The final app will use dominate to generate the html. But until I can get the CSS to load properly, I am stuck. So, for the simplified example, I just pasted text into response. BTW, it doesn’t work with the full code either.


Here is my Starlette app:

from starlette.applications import Starlette
from starlette.routing import Mount
from starlette.staticfiles import StaticFiles
from starlette.responses import HTMLResponse

routes = [
Mount(’/static’, app=StaticFiles(directory=‘static’, html=“false”), name=“static”),

async def app(scope, receive, send):

d = """<!DOCTYPE html>
               <meta charset="utf-8">
               <link rel="stylesheet" href="/static/teststatic.css">

         <body class="test-theme">
               <div class="rectangle"></div>   
              <h1 > test </h1>  
response = HTMLResponse(str(d))
await response(scope, receive, send)


The CSS is in a subfolder called “static”. Here is the css code:

.test-theme {
background-color: #1b6b13;
font-family: system-ui;
width: 100%;
height: 85px;
position: fixed;
background-color: #091b01;
grid-column-start: 1;
grid-column-end: 3;
grid-row: 1;
z-index: 1;


Here is a copy of the terminal:

uvicorn teststarlettehtmlstatic:app
INFO: Started server process [104671]
INFO: Waiting for application startup.
INFO: ASGI ‘lifespan’ protocol appears unsupported.
INFO: Application startup complete.
INFO: Uvicorn running on (Press CTRL+C to quit)
INFO: - “GET / HTTP/1.1” 200 OK
INFO: - “GET /static/teststatic.css HTTP/1.1” 200 OK
INFO: - “GET /favicon.ico HTTP/1.1” 200 OK