'bootstrap3'不是有效的标记库:ImportError raise loading bootstrap3.templatetags.bootstrap3:无法导入名称force_text

时间:2014-03-03 10:56:28

标签: django twitter-bootstrap python-2.7 django-1.4

我将通过以下链接阅读有关django-bootstrap的教程:“https://pypi.python.org/pypi/django-bootstrap3https://pypi.python.org/pypi/django-bootstrap3

在我的settings.py中:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
'example_app',
'southtut',
'south',
'bootstrap3',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',

在我的模板中:

我写过

 {% load bootstrap3 %}

但我正在上面提到的模板中接受以下几行:

TemplateSyntaxError at /myapp/product/
'bootstrap3' is not a valid tag library: ImportError raised loading     bootstrap3.templatetags.bootstrap3: cannot import name force_text
Request Method: GET
Request URL:    http://127.0.0.1:8000/myapp/product/
Django Version: 1.4.1
Exception Type: TemplateSyntaxError
Exception Value:    
'bootstrap3' is not a valid tag library: ImportError raised loading      bootstrap3.templatetags.bootstrap3: cannot import name force_text
Exception Location: C:\Python27\lib\site-packages\django\template\defaulttags.py in  load, line 1043
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.1
Python Path:    
['C:\\Users\\Gopi\\workspace\\myfirst',
'C:\\Python27\\lib\\site-packages\\geraldo-0.4.16-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\configparser-3.2.0r3-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\unittest2-0.5.1-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\ordereddict-1.1-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\passlib-1.6.1-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\south-0.8.3-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\openpyxl-1.7.0-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\xlutils-1.7.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\tesseracttrainer-0.1.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\goslate-1.1.2-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\futures-2.1.6-py2.7.egg',
 'C:\\Windows\\system32\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk',
'C:\\Python27',
'C:\\Python27\\lib\\site-packages',
'C:\\Python27\\lib\\site-packages\\PIL',
'C:\\Python27\\lib\\site-packages\\win32',
'C:\\Python27\\lib\\site-packages\\win32\\lib',
'C:\\Python27\\lib\\site-packages\\Pythonwin',
'C:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode']
Server time:    Mon, 3 Mar 2014 16:18:18 +0530

我不知道我哪里错了。请帮帮我

1 个答案:

答案 0 :(得分:1)

这里的错误是“无法导入名称force_text”,这是因为你使用的是Django 1.4