gpt4 book ai didi

Pythonanywhere 'staticfiles' 不是有效的标签库 : Template library staticfiles not found

转载 作者:太空宇宙 更新时间:2023-11-03 14:21:42 25 4
gpt4 key购买 nike

在 pythonanywhere 中,我将 virtualenv 与 Django 1.7 和 Python 2.7 一起使用

设置.py

STATIC_ROOT = '/home/movies/pantherlist/movies/static/'
STATIC_URL = '/static/'

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'pantherlist.movies',
)

wsgi.py

activate_this = '/home/movies/.virtualenvs/django17/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
.
.#path setup already done here
.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

我遇到了错误

异常类型:TemplateSyntaxError异常值:
'staticfiles' 不是有效的标记库:找不到模板库静态文件,已尝试 django.templatetags.staticfiles、django.contrib.admin.templatetags.staticfiles

异常位置:/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py in load, line 1054

错误于index.html

{% load staticfiles %}

请帮忙。提前致谢。

最佳答案

自从将 virtualenv 激活添加到您的 wsgi 文件后,您似乎没有重新加载您的网络应用程序,或者您没有使用您认为正在使用的 wsgi 文件。 Django 报告的错误位置 (/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py) 在 PythonAnywhere 上的默认系统 Django 中,而不是在您的 virtualenv 中的 Django。

关于Pythonanywhere 'staticfiles' 不是有效的标签库 : Template library staticfiles not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27210476/

25 4 0