完全按照安装步骤安装,但是出现了这个问题
django版本1.3.1
Template error
In template /home/kanghua/ComPerformance-master/webadmin/templates/accounts/login.html, error at line 34
Caught ImportError while rendering: cannot import name smart_text
大概是login.py的这行出错
严格按照教程安装,同样不能运行。为了快点让它跑起来,做了一些极其猥琐的修改: (Ubuntu 14.04,一切都用 apt-get 和 pip 安装的)
/usr/local/lib/python2.7/dist-packages/django_grappelli-2.7.1-py2.7.egg/grappelli/urls.py:
from django.conf.urls import patterns, url
改成
from django.conf.urls import *
from django.conf.urls.defaults import *
/usr/local/lib/python2.7/dist-packages/django_grappelli-2.7.1-py2.7.egg/grappelli/views/related.py:
把
from django.utils.encoding import smart_text
改成
from django.utils.encoding import smart_unicode
然后删掉
from django.contrib.admin.utils import prepare_lookup_value
from django.apps import apps
反正,为了能赶快跑起来,已经不顾脸面,不怕同行笑话了……
有谁跑起来了?求好心人告知
楼上两位,你们怎么运行起来的,赐教@ kgha
主要是这个项目用的Django太老了。要是急着想跑起来,可以直接用一个别人改好的
其他的都一样么? 我吧django改成1.5.1版本的还是跑步起来 气炸了。。。
我是按步骤来的,中途报了个缺少urls的模块,上网搜了搜把urls.py 中的第一行后面改成这样from django.conf.urls.defaults import *,然后数据库连好,其他的版本如下pil 1.1.7 ,django 1.3.1 ,grappelli 是2.2的,最初装的2.9的好像报的是模板的那个错,后来降了降级好了,xlrd是1.0.0 的版本,mysql 1.2.3 ,python版本是2.7.13,平台是window10.目前正常运行,就是/admin/ 的时候报的这个错:有知道的或者遇到的可以交流下,“TemplateSyntaxError at /admin/ Invalid template name in 'extends' tag: ''. Got this from the 'admin_template_base_site' variable.”
pil只能装1.1.7 更新的版本一样不行……真是够了……忙了一下午 终于运行起来了,但是楼上的这个问题仍然存在……
我是django1.3.1 python2.7 win7X64中间得装south库等N多个库……
主要是版本实在是太老了……
还得装mysql_python 而且必须是按照你的64还是32位版本……
服务器跑起来了,但是打开页面报错。
TemplateSyntaxError at /accounts/login/
Caught ImportError while rendering: cannot import name url
Request Method: GET Request URL: http://127.0.0.1:8000/accounts/login/?next=/ Django Version: 1.3.1 Exception Type: TemplateSyntaxError Exception Value:
Caught ImportError while rendering: cannot import name url
Exception Location: /usr/lib/python2.6/site-packages/grappelli/urls.py in
['/root/Desktop/ComPerformance-master/webadmin', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-packages', '/usr/lib64/python2.6/site-packages/PIL', '/usr/lib64/python2.6/site-packages/gst-0.10', '/usr/lib64/python2.6/site-packages/gtk-2.0', '/usr/lib64/python2.6/site-packages/webkit-1.0', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/Django-1.3.1-py2.6.egg']
Server time: 星期五, 22 九月 2017 11:39:51 +0800 Template error
In template /root/Desktop/ComPerformance-master/webadmin/templates/accounts/login.html, error at line 34 Caught ImportError while rendering: cannot import name url