【问题标题】:pythonanywhere // python manage.py collectstatic = 0 static files copied to // 175 unmodifiedpythonanywhere // python manage.py collectstatic = 0 静态文件复制到 // 175 未修改
【发布时间】:2019-12-05 23:10:46
【问题描述】:

为什么我的静态文件无法加载?

CMD

/PruebaApettito.FINAL/PruebaApettito.FINAL-master/Prueba2/proyectoapettito (master)$ python manage.py collectstatic

You have requested to collect static files at the destination
location as specified in your settings:

/home/sagutierrezr95/PruebaApettito.FINAL/PruebaApettito.FINAL-master/Prueba2/proyectoapettito/AppApettito/static

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Found another file with the destination path 'admin/js/collapse.min.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.

...
0 static files copied to '/home/sagutierrezr95/PruebaApettito.FINAL/PruebaApettito.FINAL-master/Prueba2/proyectoapettito/AppApettito/static', 175 unmodified.

设置


ALLOWED_HOSTS = ['sagutierrezr95.pythonanywhere.com']

STATIC_URL = '/static/'

STATIC_ROOT = '/home/sagutierrezr95/PruebaApettito.FINAL/PruebaApettito.FINAL-master/Prueba2/proyectoapettito/AppApettito/static/'

我需要页面上的模板,但我不知道我做错了什么。路线应该是正确的,没有拼写错误

【问题讨论】:

标签: python django pythonanywhere


【解决方案1】:

static_root 而不是这个

STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), '/var/www/static/', ]

你可以使用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-19
    • 2020-12-05
    • 1970-01-01
    • 1970-01-01
    • 2020-06-13
    • 2020-11-18
    • 2013-01-06
    • 2018-07-21
    相关资源
    最近更新 更多