Django — Can't get static CSS files to load

后端 未结 20 1902
借酒劲吻你
借酒劲吻你 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:13

    Read this carefully: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/

    Is django.contrib.staticfiles in your INSTALLED_APPS in settings.py?

    Is DEBUG=False? If so, you need to call runserver with the --insecure parameter:

    python manage.py runserver --insecure
    

    collectstatic has no bearing on serving files via the development server. It is for collecting the static files in one location STATIC_ROOT for your web server to find them. In fact, running collectstatic with your STATIC_ROOT set to a path in STATICFILES_DIRS is a bad idea. You should double-check to make sure your CSS files even exist now.

提交回复
热议问题