Satchmo笔记1 - 安装(续)
再次检测,再次出错:
Error: One or more models did not validate:
discount.discount: "automatic": BooleanFields do not accept null values. Use a NullBooleanField instead.
discount.discount: "freeShipping": BooleanFields do not accept null values. Use a NullBooleanField instead.
discount.discount: "includeShipping": BooleanFields do not accept null values. Use a NullBooleanField instead.
几个域的Fields已经不合格了。问题应该不大。
快凌晨一点了,想起了《梦断代码》,程序员大部分的时间都是在找错。
--------------------------------------
继续,根据出错信息,所有出错的models都在discount里。
按照提示将几个域修改后,再次测试:
root@fruitschen-desktop:~/workspace/satchmo_store# python manage.py satchmo_check
Checking your satchmo configuration.
Using Django version 1.1 beta 1 SVN-11227
Using Satchmo version 0.8-1-SVN-unknown
The following errors were found:
Locale is not set correctly. Try
Unix: sudo locale-gen en_US
If the above does not work, try
sudo localedef -i en_US -f ISO-8859-1 en_US
Windows: set LANGUAGE_CODE in settings.py to LANGUAGE_CODE = 'us'
本地化有问题,运行
root@fruitschen-desktop:~/workspace/satchmo_store# locale-gen en_US
Generating locales...
en_US.ISO-8859-1... done
Generation complete.
再次测试,无错误!
Your configuration has no errors.
下面的几步照文档做,没遇到什么麻烦:
python manage.py syncdb
python manage.py satchmo_load_l10n
python manage.py satchmo_load_store
python manage.py satchmo_load_us_tax
浏览
浏览文档里的 http://127.0.0.1:8000/store —— 404
貌似应该是 http://127.0.0.1:8000/shop,所有的媒体文件都没有读出来,看来是MEDIA_ROOT和MEDIA_URL的事。查看settings:
MEDIA_ROOT = os.path.join(DIRNAME, 'static/')
MEDIA_URL = ''
修改如下
MEDIA_URL = '/static/'
然后将satcmo里static的内容复制到这个static中,css和js已经正常载入,图片还是有问题:
[27/Jul/2009 19:47:37] "GET /static//root/workspace/satchmo_store/static/images/productimage-picture-default_t85.jpg HTTP/1.1" 404 1965
试图进入admin进行修改,再次出错!试图进入某些栏目的时候:
TypeError at /admin/product/product/3/
__init__() got an unexpected keyword argument 'request'
查 了一下,最有可能是新版的 Django 加上旧版的Satchmo造成的,看来要倒退到Django1.0.2了。不过我的那个Pinax最好还是和svn的版本一起工作,像个办法保留多版本的 Django吧。试了一下,下载Django 1.0.2,把里面的Django文件夹复制到satchmo_store文件夹里,重启服务器。一切OK!
Django version 1.0.2 final, using settings 'satchmo_store.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
修复图片不显示的问题,重新syncdv就可以了,重启服务器,一切ok……
经过痛苦的折腾过程,终于把Satchmo安装好了,不容易啊!