0

Right, being a Python & Django student using VSC so therefore, in the interest of not having a nervous breakdown here, how on earth do other VSC users import CSS files into their HTML/PHP documentation?

This is clear a server issue (hence why this is being posted here and not Stack Overflow) because as far as I'm concerned, my code is correct.

  1. Created a HTML document with the filename base.html and added {% load static %} at the top of said document. I have then created a HTML document & added {% extends 'base.html' %} at the top.
  2. Created a static folder in the root directory, a sub-director folder of css and created a CSS document with the filename main.css
  3. Went into the Settings, added STATICFILES_DIR = [BASE_DIR / "static"] and confirmed that STATIC_URL = "static/" was present
  4. Confirmed base & path directory as BASE_DIR = Path(__file__).resolve().parent.parent
  5. With all this confirmed, I went into the HTML document and uploaded the stylesheet in the following manner <link rel="stylesheet" href="{% static 'css/main.css' %}"> which can be seen when I go to inspect the document from the browser.

However, despite all this, the server is still completely ignoring any CSS documentation, as a test, I have set the <body> tag to a different background-color and low and behold. I don't see a single shade of blue.

I'm genuinely at a loss as to how - despite following the documentation to the letter - I get a different result. As I started earlier, its clearly a server issue because unless I'm going crazy (which is hardly surprising considering I have to work with VSC) I fail to see what I'm doing wrong here.

Path Build

HTML Document

Inspect Element

Python Settings

1
  • This is clear a server issue - It is not. It's a development environment and therefore off topic. You can post it on SO once your suspension ends. Commented Sep 27, 2023 at 10:04

0

You must log in to answer this question.

Browse other questions tagged .