Django 管理页面样式

Django admin page style

我是 django 的新手,我为管理页面创建了一个超级用户,我也安装了 bootstrap3 并将它放在已安装的应用程序部分。然而,与我使用的教程相比,我的管理页面没有任何风格 我安装了 bootstrap3 并将其放在 settings.py 部分。如果您需要更多信息,可以询问,我也是堆栈溢出的新手

您的样式表(静态文件)未加载。要解决此问题,您需要收集静态文件。更多相关信息 here.

Deployment


django.contrib.staticfiles provides a convenience management command for gathering static files in a single directory so you can serve them easily.

  1. Set the STATIC_ROOT setting to the directory from which you’d like to serve these files, for example: STATIC_ROOT = "/var/www/example.com/static/"

  2. Run the collectstatic management command: $ python manage.py collectstatic This will copy all files from your static folders into the STATIC_ROOT directory.

  3. Use a web server of your choice to serve the files. Deploying static files covers some common deployment strategies for static files.