Python Django管理css文件未呈现

Python Django管理css文件未呈现,python,css,django,django-admin,Python,Css,Django,Django Admin,我正在使用django管理来处理基本CRUD。我的管理模板很容易加载,甚至css文件也加载了,但它没有显示任何效果 我试图收集静态文件,如下所示 Manage.py collectstaic 它显示以下错误 Traceback (most recent call last): File "C:\Python27\Lib\site-packages\django\bin\hello\manage.py", line 10, in module> execute_from_com

我正在使用django管理来处理基本CRUD。我的管理模板很容易加载,甚至css文件也加载了,但它没有显示任何效果

我试图收集静态文件,如下所示

Manage.py collectstaic
它显示以下错误

Traceback (most recent call last):
  File "C:\Python27\Lib\site-packages\django\bin\hello\manage.py", line 10, in
module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
399, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
272, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
76, in load_command_class
    return module.Command()
  File "C:\Python27\lib\site-packages\django\contrib\staticfiles\management\com
ands\collectstatic.py", line 58, in __init__
    self.storage.path('')
  File "C:\Python27\lib\site-packages\django\contrib\staticfiles\storage.py", l
ne 46, in path
    raise ImproperlyConfigured("You're using the staticfiles app "
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app w
thout having set the STATIC_ROOT setting to a filesystem path.

如何解决ut?

包括您的
静态根
,例如

STATIC_ROOT = 'staticfiles' 
STATIC_URL = '/static/' 
STATICFILES_DIRS = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'static')
然后在
url.py
文件中包含相应的url,例如

urlpatterns = patterns('', ) +static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
记得把

from django.conf import settings
from django.conf.urls.static import static
在您的
url.py中


然后在您的终端类型中
python manage.py collectstatic
not collectstatic

在settings.py中设置STATIC\u ROOT?django必须知道你想在哪里收集静态文件