python - 找不到 pythonanywhere 中的 css 静态文件

标签 python django pythonanywhere static-files web-publishing

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

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 它将从您的应用程序文件夹中收集静态文件并将它们放在那里

关于python - 找不到 pythonanywhere 中的 css 静态文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54800605/

相关文章:

python - Pandas DataFrame.Groupby.Agg 字典中的自定义列选择

python - 针对线程中的错误启动调试器

python - 进行不区分大小写的替换但匹配要替换的单词的大小写的最佳方法?

python - 关于 django form.errors 的问题,获取原始错误消息

python - 使用 PythonAnywhere 作为游戏服务器

python - Gspread,PythonAnywhere : "OSError: [Errno 101] Network is unreachable" - Trying to Connect to Google Sheets

python - 周期性操作错误: (2006, 'MySQL server has gone away')

python - 两个客户端没有成功连接到服务器

Django Rest Framework - 如何为所有 ModelSerializer 字段创建自定义错误消息?

Jquery Ajax 发布到 Django View