search

Home  >  Q&A  >  body text

linux - django静态文件加载错误

PHPzPHPz2833 days ago654

reply all(2)I'll reply

  • 阿神

    阿神2017-04-17 15:47:46

    1. The official document has this sentence, check if your Debug is True

    During development, if you use django.contrib.staticfiles, this will be done automatically by runserver when DEBUG is set to True (see django.contrib.staticfiles.views.serve()).

    2. static_root是给python manage.py collectstatic用的,这个目录是给app以外的共同Static目录使用的,不要与app自己目录下的static重名。我觉的你可以把这个配置去掉,或者指向另一个目录,比如project/static
    3、如果你指定了static_root,可以运行python manage.py collectstatic,然后看一看,在static_root Check whether the static files under your app are collected correctly. 4. To help locate static files, this command can help you troubleshoot the problem.

    python manage.py findstatic /blog/css/style.css --verbosity 2

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 15:47:46

    A small spell error.

    reply
    0
  • Cancelreply