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: “http://127.0.0.1:8000/static/teststatic.css

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>
   <html>
        <head>
               <meta charset="utf-8">
               <title>teststarlettehtml</title>
               <link rel="stylesheet" href="/static/teststatic.css">

         </head>
         <body class="test-theme">
               <div class="rectangle"></div>   
              <h1 > test </h1>  
         </body>
   </html>"""
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;
color:#e71d7c;
font-family: system-ui;
}
.rectangle{
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 http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: 127.0.0.1:40688 - “GET / HTTP/1.1” 200 OK
INFO: 127.0.0.1:40688 - “GET /static/teststatic.css HTTP/1.1” 200 OK
INFO: 127.0.0.1:40688 - “GET /favicon.ico HTTP/1.1” 200 OK