【问题标题】:python manage.py collectstatic - 0 static files copiedpython manage.py collectstatic - 复制了 0 个静态文件
【发布时间】:2020-06-13 13:05:32
【问题描述】:

美好的一天,我正在尝试在 pythonanywhere 的 bash 上运行命令:python manage.py collectstatic 下面我粘贴了输出。有什么建议吗?

(science.pythonanywhere.com) 12:36 ~/science.pythonanywhere.com (master)$ python manage.py collectstatic
You have requested to collect static files at the destination location as specified in your settings:
/home/science/science.pythonanywhere.com/static
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes

0 static files copied to '/home/science/science.pythonanywhere.com/static', 130 unmodified.

【问题讨论】:

    标签: django pythonanywhere


    【解决方案1】:

    这意味着没有任何更改,您的所有静态文件都已存在于目标中

    【讨论】:

    • 我正在学习教程,此时必须复制文件。按照教程所说的:像 PythonAnywhere 这样的服务器喜欢将“静态文件”(如 CSS 文件)与 Python 文件区别对待,因为它们可以优化它们以更快地加载。因此,每当我们对 CSS 文件进行更改时,我们都需要在服务器上运行一个额外的命令来告诉它更新它们。该命令称为 collectstatic。因此,在给出命令 collectstatic 之后,必须发生一些事情。此外,远程服务器上的网站外观比我本地服务器上的更差。
    • Collectstatic 创建一个从静态目录到静态根目录的所有静态文件(css、图像、js...)的副本。路径在 django 设置中定义
    猜你喜欢
    • 1970-01-01
    • 2018-11-19
    • 2020-12-05
    • 1970-01-01
    • 2020-06-13
    • 2013-01-06
    • 2016-02-01
    • 2022-01-25
    • 2018-11-02
    相关资源
    最近更新 更多