官方网站:http://www.satchmoproject.com/
第一印象:文档比Pinax显得更正规一些。
文档地址:http://www.satchmoproject.com/docs/svn/new_installation.html
安装之前,已经有PIL,跳过。
root@fruitschen-desktop:~# easy_install pycrypto
Searching for pycrypto
Reading http://pypi.python.org/simple/pycrypto/
Reading http://pycrypto.sourceforge.net
Reading http://www.amk.ca/python/code/crypto
Best match: pycrypto 2.0.1
……
root@fruitschen-desktop:~# easy_install http://code.enthought.com/enstaller/eggs/rhel/3/Reportlab-2.1.0001-py2.5.egg
Downloading http://code.enthought.com/enstaller/eggs/rhel/3/Reportlab-2.1.0001-py2.5.egg
Processing Reportlab-2.1.0001-py2.5.egg
Installed /usr/local/lib/python2.6/dist-packages/Reportlab-2.1.0001-py2.5.egg
Processing dependencies for Reportlab==2.1.0001
Searching for Reportlab==2.1.0001
Reading http://pypi.python.org/simple/Reportlab/
Reading http://www.reportlab.com/
No local packages or download links found for Reportlab==2.1.0001
error: Could not find suitable distribution for Requirement.parse('Reportlab==2.1.0001')
安装 Reportlab 的时候报错了。
root@fruitschen-desktop:~# easy_install django-registration
Searching for django-registration
Reading http://pypi.python.org/simple/django-registration/
Download error: [Errno -2] Name or service not known -- Some packages may not be found!
Reading http://pypi.python.org/simple/django-registration/
……
文档里的
easy_install http://tinyforge.org/frs/download.php/1/trml2pdf.tar.gz
地址已经不存在了,祸不单行,Python官方的也不好使了:
root@fruitschen-desktop:~# easy_install trml2pdf
Searching for trml2pdf
Reading http://pypi.python.org/simple/trml2pdf/
Reading http://tiny.be
No local packages or download links found for trml2pdf
error: Could not find suitable distribution for Requirement.parse('trml2pdf')
最后救命的是Ubuntu的软件包管理器,Thank Ubuntuness!
root@fruitschen-desktop:~# easy_install PyYAML
Searching for PyYAML
Reading http://pypi.python.org/simple/PyYAML/
Reading http://pyyaml.org/wiki/PyYAML
Best match: PyYAML 3.08
……
中间出了几个警告
无法直接 easy_install django-threaded-multihost
从 http://gosatchmo.com/apps/django-threaded-multihost/ 下载到egg文件。切换到文件保存的文件夹,运行
root@fruitschen-desktop:~/桌面# easy_install django_threaded_multihost-1.3_0-py2.5.egg
Processing django_threaded_multihost-1.3_0-py2.5.egg
Copying django_threaded_multihost-1.3_0-py2.5.egg to /usr/local/lib/python2.6/dist-packages
Adding django-threaded-multihost 1.3-0 to easy-install.pth file
Installed /usr/local/lib/python2.6/dist-packages/django_threaded_multihost-1.3_0-py2.5.egg
Processing dependencies for django-threaded-multihost==1.3-0
Searching for django-threaded-multihost==1.3-0
Reading http://pypi.python.org/simple/django-threaded-multihost/
Couldn't find index page for 'django-threaded-multihost' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for django-threaded-multihost==1.3-0
error: Could not find suitable distribution for Requirement.parse('django-threaded-multihost==1.3-0')
root@fruitschen-desktop:~/桌面# svn checkout http://django-app-plugins.googlecode.com/svn/trunk/ django-app-plugins-read-only
没有按照文档上的方法安装,而是直接把 app_plugins 目录夹拷贝到了Python2.6/dist-packages/目录下。在终端打开python,
>>> import app_plugins
>>> app_plugins.__file__
'/usr/lib/python2.6/dist-packages/app_plugins/__init__.py'
证明安装成功。
root@fruitschen-desktop:/usr/lib/python2.6/dist-packages# svn checkout http://sorl-thumbnail.googlecode.com/svn/trunk/sorl/
这次是直接在Python的库文件夹里svn的目录,测试一下:
>>> import sorl
>>> sorl.file
>>> sorl.__file__
'/usr/lib/python2.6/dist-packages/sorl/__init__.py'
这两个都直接easy_install就可以了。
hg命令不好使,提示需要安装mercurial,运行:
root@fruitschen-desktop:~# apt-get install mercurial
root@fruitschen-desktop:~# hg clone http://bitbucket.org/chris1610/satchmo/
等等,由于项目需要,应该是安装0.8.1版的。在官方的主页上有0.8.1 release 的下载,解压到任意位置。
root@fruitschen-desktop:~/satchmo-0.8.1# python setup.py install
测试svn版本是否安装成功使用
>>> import satchmo_store
>>> satchmo_store.get_version()
0.8.1版本使用
>>> import satchmo
>>> satchmo.VERSION
(0, 8, 1)
切换到要建立项目的文件夹,
root@fruitschen-desktop:~# cd workspace/
root@fruitschen-desktop:~/workspace# django-admin.py startproject satchmo_store
按照文档修改settings文件,添加需要的条目。
从satchmo安装文件夹复制 local_settings-customize.py 到项目文件夹中,重命名为local_settings.py。
越过官方文档的 Copy the rest of the required files 一步,参考下面的博客创建项目的布局
http://gosatchmo.com/starting-a-new-store-real-world-project-layout
1。创建基本的文件夹布局,和上面文章完全一致。
2。设置url,修改项目的urls.py:
from satchmo.urls import urlpatterns
urlpatterns += patterns('',
……
3。设置模板,修改settings.py(文章里介绍的是修改local_settings.py)
SATCHMO_DIRNAME = os.path.abspath(os.path.dirname(satchmo.__file__))
TEMPLATE_DIRS = (
os.path.join(DIRNAME, "templates"),
os.path.join(SATCHMO_DIRNAME, "templates"),
)
测试设置的正确性,结果还真出了问题
root@fruitschen-desktop:~/workspace/satchmo_store# python manage.py satchmo_check
Traceback (most recent call last):
File "manage.py", line 4, in
import settings # Assumed to be in the same directory.
File "/root/workspace/satchmo_store/settings.py", line 79, in
SATCHMO_DIRNAME = os.path.abspath(os.path.dirname(satchmo.__file__))
NameError: name 'satchmo' is not defined
root@fruitschen-desktop:~/workspace/satchmo_store# python manage.py satchmo_check
Error: No module named comment_utils
原因是在settings.INSTALLED_APPS 中包含了这个app,只要下载了之后放到Python路径中就可以。不过项目的首页(http://code.google.com/p/django-comment-utils/)上居然说这个app 和1.0之后的Django兼容性差,而且没有必要。所以直接从settings中去掉。
再次检测,再次出错:
AttributeError: 'DatabaseWrapper' object has no attribute '_leave_transaction_management'
经过搜索,修改settgins.py设置数据库选项和数据库名称。
再次检测,再次出错:
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已经不合格了。问题应该不大。
快凌晨一点了,想起了《梦断代码》,程序员大部分的时间都是在找错。