Giter VIP home page Giter VIP logo

dailyfresh-b2c's Introduction

dailyfresh-B2C 分布式

dailyfresh mall based on B2C model
基于B2C的天天生鲜商城

B2C(Business-to-Customer), 企业对个人的一种商业模式,简称"商对客". 商对客是电子商务的一种模式,这种电子商务一般以网络零售业为主,主要借助于互联网开展在线销售活动。 B2C即企业通过互联网为消费者提供一个新型的购物环境——网上商店,消费者通过网络在网上购物、网上支付等消费行为。

为消费者提供一个新型的购物环境:
从0开始,立项、构建、开发到部署, 搭建一个天天生鲜商场

技术栈

  • 语言:Python3.* (Django)
  • 数据库: MySql、 redis
  • 任务队列(异步处理): celery(django-celery)
  • 分布式文件存储: FastDFS
  • 搜索引擎(商品检索): haystack(django-haystack)、whoosh、二次开发
  • web服务器配置: Nginx+ uwsgi
  • 开发环境: PyCharm、Linux、vim

技术架构

  • 开发架构
    采用BS结构, 即Browser/Server(浏览器/服务器)结构,构建一个web的网站商城系统, 其架构逻辑:
    frame

  • 部署架构
    Nginx+uwsgi
    deploy

主体模块

主要分为四个大模块:

数据库表

DB

  • SPU是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。通俗点讲,属性值、特性相同的商品就可以称为一个SPU。
    例如,iphone4就是一个SPU,N97也是一个SPU,这个与商家无关,与颜色、款式、套餐也无关。
  • SKU即库存进出计量的单位, 可以是以件、盒、托盘等为单位,在服装、鞋类商品中使用最多最普遍。
    例如纺织品中一个SKU通常表示:规格、颜色、款式。

功能模块展示

点击查看--多图预警

功能与性能优化

  1. 用户注册发激活邮件时,可能发送邮件所需的时间较长,客户端会需要等待,用户体验不好。

改进: 把耗时的任务放到后台异步执行,此处使用celery任务队列, 其中使用redis作中间件。

  1. redis存储用户历史浏览记录, 采用list数据结构: History_用户id: [skuid1,skuid2,skuid3]
  2. 使用redis存储用户购物车商品信息,采用hash数据结构: cart_userid: {'sku_id1': num, 'sku_id2': num}
  3. 采用分布式文件系统, 把商品图片等信息存储在FastDFS系统中, Nginx+FastDFS配合, 减少服务器的压力。
  4. 页面静态化: 首页、商品列表页、商品详情页等用户共同的页面, 把页面静态化,以减少对数据库的操作。当后台数据更改时自动重新生成静态页。
  5. 页面数据缓存,把页面使用的数据存放在缓存中,当再次使用这些数据时,先从缓存中获取,如获取不到,再去查询数据库,减少数据库的查询次数。
  6. 订单并发

Links

dailyfresh-b2c's People

Contributors

ylisen avatar ylisen520 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dailyfresh-b2c's Issues

上传图片问题

您好,我已搭建好fdfs,但是仍无法上传图片,控制台提示:
getting connection
<fdfs_client.connection.Connection object at 0x00000000060B6438>
<fdfs_client.fdfs_protol.Tracker_header object at 0x00000000060B6DA0>
一直无响应,非常感谢

在任务处理者worker一端加以下几句如何理解

你好,

我这边环境是windows server ,如何理解下面的注释呢?
目前我注册没有响应, 单独跑task.py 出错

django环境的初始化,在任务处理者worker一端加以下几句

import os

import django

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dailyfresh.settings')

django.setup()

C:\python37\python.exe C:/Users/Administrator/dailyfresh-B2C-master/dailyfresh/celery_tasks/tasks.py
Traceback (most recent call last):
File "C:/Users/Administrator/dailyfresh-B2C-master/dailyfresh/celery_tasks/tasks.py", line 15, in
from apps.goods.models import GoodsType, IndexGoodsBanner, IndexPromotionBanner, IndexTypeGoodsBanner
File "C:\Users\Administrator\dailyfresh-B2C-master\dailyfresh\apps\goods\models.py", line 3, in
from db.base_model import BaseModel
File "C:\Users\Administrator\dailyfresh-B2C-master\dailyfresh\db\base_model.py", line 12, in
class BaseModel(models.Model):
File "C:\python37\lib\site-packages\django\db\models\base.py", line 103, in new
app_config = apps.get_containing_app_config(module)
File "C:\python37\lib\site-packages\django\apps\registry.py", line 252, in get_containing_app_config
self.check_apps_ready()
File "C:\python37\lib\site-packages\django\apps\registry.py", line 134, in check_apps_ready
settings.INSTALLED_APPS
File "C:\python37\lib\site-packages\django\conf_init_.py", line 79, in getattr
self.setup(name)
File "C:\python37\lib\site-packages\django\conf_init
.py", line 64, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Process finished with exit code 1

Who to contact for security issues

Hey there!

I belong to an open source security research community, and a member (@DiG2) has found an issue, but doesn’t know the best way to disclose it.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

index页面

显示不出图片
所有图片都显示不出来。
是不是需要导入mysql?
还有fdfs要导入数据吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.