用python实现网上书店

需求:

 1:每个用户的 购物车(cart) 用合适的数据结构缓存在内存中。

 2:对每个数据对象的访问,合理设置并管理缓存(使用独立的模块读写数据库)。让程序结构变得可管理、可维护。

 3:对每种商品,设定一个库存。下订单就(假设不需要付款)完成需要减库存。

 4:将 商品详情 页面的 当前库存 采用 ajax 延迟加载。

实现:

1 : 数据库使用mongodb,同时使用redis将部分数据缓存在内存中

2:相关的数据设计

代码链接https:https://github.com/sysuKinthon/bookstore/tree/master/bookstore

参考:

1)torando(mongodb与模板): http://demo.pythoner.com/itt2zh/

2)redis操作:https://redis-py.readthedocs.org/en/latest/index.html

原文地址:https://www.cnblogs.com/kinthon/p/5003842.html