css 找不到 pythonanywhere 中的静态文件

css static file in pythonanywhere not found

我知道这个话题没有被提出过一次,我重新阅读并尝试了所有的选项,但由于某种原因,错误并没有消失,样式也没有连接在这里输入图片描述

connect static

path directory

error in load site

path in templates

在您自己的本地系统上,静态文件将由 django 开发服务器提供服务。在像 PythonAnywhere 这样的生产设置中,您需要在 settings.py 中设置 STATIC_ROOT,例如:/home/yourusername/myproject/static

然后 运行 python manage.py collectstatic 将从您的应用程序文件夹中收集静态文件并将它们放在那里

在您的模板代码中删除 space 来自:

 (% static    '  css/style.css' %)
               |
               |
               |
               |
             #this one