Django — Can't get static CSS files to load

后端 未结 20 1850
借酒劲吻你
借酒劲吻你 2020-11-29 23:45

I\'m running Django\'s development server (runserver) on my local machine (Mac OS X) and cannot get the CSS files to load.

Here are the relevant entries

20条回答
  •  借酒劲吻你
    2020-11-30 00:04

    Add the following code to your settings.py:

    STATICFILES_DIRS = [
        os.path.join(BASE_DIR, "static"),
    ]
    

    After that, create the static folder at the root directory of your project.

    To load the static files on templates use:

    {% load static %}
      My image
    

提交回复
热议问题