How does STATIC_URL work?

Two things - first, if you’re running in development mode using runserver (or runserver_plus), Django will fetch your static files from within your project structure. (See Serving static files in development.

Second, and this is universally true - there is no requirement that a URL represent an actual path on a server. A URL is just a request to a server for a resource. It’s up to the server to determine what resource to retrieve for each request. (In fact, more often than not, they don’t.) In the case of static files, the server maps that static url to an actual directory.

1 Like