Contents
- business model introduction
- > prompt: 1.architecture design Analyze the technical points that may be used. Whether the front and rear ends are separated? What frameworks are used in the front end? What frameworks are used in the backend, Django, Flask,… What database to choose How to implement caching How to build distributed services How to manage source code …… 2.Database design The design of database tables is very important. Design appropriate database tables according to project requirements. If the database table is unreasonable in the early stage, it will be difficult to maintain with the increase of demand later. …… 3.integration testing In the testing phase, we should pay attention to the BUG mail sent by the test system. 4.Whether the front and rear ends are separated? DjangoThe frame is usually separated from the front end and the rear end needs to deal with some business logic of the front end. The back end uses templates to dynamically render HTML pages to respond to clients. The backend maintenance of HTML pages is stressful, but it must be borne. Front end separation can also be achieved. Do not use templates to directly respond to some data such as JSON to the client. FlaskFrame, usually front and rear end separation.
- thinking:
- Django send mail.”
- Celery send mail asynchronously.”
- login logic”
- login logic implementation”
- demand analysis > remember user technology point analysis It is known that: The user’s session information is stored in the redis database of the server. In the browser’s cookie, user sessionid information is stored. Every request the browser brings cookie information. Conclusion: remember that the user is setting the session validity period. request.session.set_expiry(value) If value is an integer, the session will expire after value seconds are not active. If value is 0, the Cookie of the session will expire at the end of the user’s browsing session. If value is None, then the session expires in two weeks. Exit logon
- 1.Business model specification
- 2.Introduction of development process
- 3.Project requirement analysis
- 4.Project architecture analysis
- 5.Database design
- 6.Model class specification
- 7.Create dailyfresh project
- 8.Display registration page
- 9.Get and post request processing for view functions
- 10.Class view
1.B2B– business to business”- B2B (Business to Business)It means that both the supplier and the demander are businessmen (or enterprises, companies) who use Internet technology or various business network platforms to complete business transactions. Electronic commerce is a concrete manifestation of modern B2B marketing.
- Case: Alibaba, HC
2.C2C– person to person”
- C2C That is, Customer to Customer, which means the behavior of e-commerce among consumers. For example, a consumer has a computer, through the network transactions, it is sold to another consumer, this type of transaction is called C2C e-commerce. ` ` ` ` ` ` ` ` ` ‘.
- Case: Taobao, eBay and melon seeds used cars
3.B2C– enterprise to individual”
- B2C It is the abbreviation of Business to Customer, and its Chinese is referred to as “business to customer”. “Business to Customer” is a mode of e-commerce, that is to say, the commercial retail mode of selling products and services directly to consumers. This form of e-commerce is generally based on network zero.Selling is the main business, and online sales activities are mainly based on the Internet. B2C means that enterprises provide consumers with a new shopping environment through the Internet – online stores, consumers through the Internet shopping, online payment and other consumer behavior.
- Case: vip.com, Lok bee net
4.C2B– personal to business”
- C2B(Consumer to Business,That is, consumers to enterprises, is a new business mode in the era of Internet economy. This model changes the relationship between producers (businesses and institutions) and consumers. It is a kind of Create Value, a kind of Consume Value.. The C2B model is the opposite of the well-known DSM (Demand Supply Model). The real C2B should be produced first by the consumer demand and then by the enterprise production, that is, first by the consumer demand, then by the enterprise production organization according to the demand.. Usually consumers customize products and prices according to their own needs, or actively participate in product design, production and pricing, products, prices and other highlights the individual needs of consumers, customized production enterprises.
- Case: Haier mall, Shangpin home delivery
5.O2O– online to offline”
- O2O Online To Offline refers to the combination of offline business opportunities with the Internet, making the Internet a platform for offline transactions. The concept originated in the United States. The concept of O2O is very extensive. It can involve both online and related.Under the line, it can be called O2O. The mainstream business management course introduces and focuses on the new business model of O2O. ` ` ` ` ` ` ` ` ` ‘.
- Case: American regiment, hungry?
6.F2C– factories to individuals”
- F2C Refers to the Factory to customer, that is, from the manufacturer to the consumer e-commerce mode.
- Case: DELL
7.B2B2C– Enterprises — Enterprises — individuals.
B2B2C E-commerce is a type of online shopping business model, B is the abbreviation of BUSINESS, C is the abbreviation of CUSTOMER, the first B refers to the supplier of goods or services, the second B refers to the enterprise engaged in e-commerce, C is the consumer.. The first BUSINESS is not limited to brand suppliers, film and television production companies and Book publishers, any supplier of goods or services can become the first BUSINESS; the second B B2C model of e-commerce enterprises, through unificationThe operation and management of goods and services, consumer terminals at the same time integration, is a bridge between the vast number of suppliers and consumers, suppliers and consumers to provide quality services, Internet e-commerce service providers. C represents consumers, shopping in a unified e-commerce platform built on second B.Consumers. B2B2C originates from the evolution and perfection of the current B2B and B2C mode. It combines B2C and C2C perfectly, and builds its own logistics supply chain system through B2B2C e-commerce enterprises to provide unified services.
Case: Jingdong mall, Tmall mall
project requirement analysis
project framework analysis function module explanation.
1. user module”
register.html
login.html
user_center_info.html
user_center_order.html
user_center_site.html
- Registration page
- Display registration page
- Realizing user’s registration logic
- Login page
- Display login page
- Realizing user login logic
- User center
- User center information page:
- Displays user information, including user name, phone number, and address, while the bottom of the page shows the product information that the user recently browsed
- User center address page:
- Displays the current address of the user, and the form at the bottom of the page can add the address of the user.
- User center order page:
- Displays current user order information
2. commodity module”
index.html
list.html
detail.html
- home page
- Click on the corresponding product category link on the page and jump to the corresponding merchandise list page.
- Each category of goods displays 4, and displays according to the default sort.
- 3 latest product titles are displayed behind each category of merchandise.
- Click on a product to jump to the details page of the product.
- If the user is logged in, the information on the login user is displayed at the top of the page.
- Product details page
- Showing the details of a particular product.
- The bottom left part of the page shows 2 latest product information of the commodity.
- List of goods
- Display list data of a particular commodity.
- The bottom left part of the page shows 2 latest product information of the commodity.
- Other
- Search for merchandise information through page search box
3. Shopping Cart module”
cart.html
- List page and detail page add goods to shopping cart.
- After the user logs in, in addition to the registration page and login page, other pages display the number of items in the logged-in user’s shopping cart
- Shopping cart page: the operation of goods in the user’s shopping cart. If you choose a product, increase or decrease the number of goods in the shopping cart.
4. order module”
place_order.html
- Submit order page: display merchandise information that users are prepared to purchase.
- User center information page displays user order information.
> prompt
- Project development requires data to drive, so we need to think about how to design the database table first.
- Only when the database table is designed, can the backstage operators publish data to the database through the backstage management platform
- DjangoEmbedded ORM framework, we manipulate database through object oriented thinking through model classes.
- A model class maps a table in the database.
> database table details
base class: BaseModel
- Model class supplementary fields are used as base classes.
function module explanation.
1. user module”
register.html
login.html
user_center_info.html
user_center_order.html
user_center_site.html
- Registration page
- Display registration page
- Realizing user’s registration logic
- Login page
- Display login page
- Realizing user login logic
- User center
- User center information page:
- Displays user information, including user name, phone number, and address, while the bottom of the page shows the product information that the user recently browsed
- User center address page:
- Displays the current address of the user, and the form at the bottom of the page can add the address of the user.
- User center order page:
- Displays current user order information
2. commodity module”
index.html
list.html
detail.html
- home page
- Click on the corresponding product category link on the page and jump to the corresponding merchandise list page.
- Each category of goods displays 4, and displays according to the default sort.
- 3 latest product titles are displayed behind each category of merchandise.
- Click on a product to jump to the details page of the product.
- If the user is logged in, the information on the login user is displayed at the top of the page.
- Product details page
- Showing the details of a particular product.
- The bottom left part of the page shows 2 latest product information of the commodity.
- List of goods
- Display list data of a particular commodity.
- The bottom left part of the page shows 2 latest product information of the commodity.
- Other
- Search for merchandise information through page search box
3. Shopping Cart module”
cart.html
- List page and detail page add goods to shopping cart.
- After the user logs in, in addition to the registration page and login page, other pages display the number of items in the logged-in user’s shopping cart
- Shopping cart page: the operation of goods in the user’s shopping cart. If you choose a product, increase or decrease the number of goods in the shopping cart.
4. order module”
place_order.html
- Submit order page: display merchandise information that users are prepared to purchase.
- User center information page displays user order information.
> prompt
- Project development requires data to drive, so we need to think about how to design the database table first.
- Only when the database table is designed, can the backstage operators publish data to the database through the backstage management platform
- DjangoEmbedded ORM framework, we manipulate database through object oriented thinking through model classes.
- A model class maps a table in the database.
> database table details
base class: BaseModel
- Model class supplementary fields are used as base classes.
function module explanation.
1. user module”
register.html
login.html
user_center_info.html
user_center_order.html
user_center_site.html
- Registration page
- Display registration page
- Realizing user’s registration logic
- Login page
- Display login page
- Realizing user login logic
- User center
- User center information page:
- Displays user information, including user name, phone number, and address, while the bottom of the page shows the product information that the user recently browsed
- User center address page:
- Displays the current address of the user, and the form at the bottom of the page can add the address of the user.
- User center order page:
- Displays current user order information
- User center information page:
2. commodity module”
index.html
list.html
detail.html
- home page
- Click on the corresponding product category link on the page and jump to the corresponding merchandise list page.
- Each category of goods displays 4, and displays according to the default sort.
- 3 latest product titles are displayed behind each category of merchandise.
- Click on a product to jump to the details page of the product.
- If the user is logged in, the information on the login user is displayed at the top of the page.
- Product details page
- Showing the details of a particular product.
- The bottom left part of the page shows 2 latest product information of the commodity.
- List of goods
- Display list data of a particular commodity.
- The bottom left part of the page shows 2 latest product information of the commodity.
- Other
- Search for merchandise information through page search box
3. Shopping Cart module”
cart.html
- List page and detail page add goods to shopping cart.
- After the user logs in, in addition to the registration page and login page, other pages display the number of items in the logged-in user’s shopping cart
- Shopping cart page: the operation of goods in the user’s shopping cart. If you choose a product, increase or decrease the number of goods in the shopping cart.
4. order module”
place_order.html
- Submit order page: display merchandise information that users are prepared to purchase.
- User center information page displays user order information.
> prompt
- Project development requires data to drive, so we need to think about how to design the database table first.
- Only when the database table is designed, can the backstage operators publish data to the database through the backstage management platform
- DjangoEmbedded ORM framework, we manipulate database through object oriented thinking through model classes.
- A model class maps a table in the database.
> database table details
base class: BaseModel
- Model class supplementary fields are used as base classes.
Field name | Field type | field option | Field description |
---|---|---|---|
create_time | DateTimeField | auto_now_add=True | Creation time |
update_time | DateTimeField | auto_now=True | Update time |
commodity list
- Model class name:
GoodsCategory
;Table name:df_goods_category
GoodsCategory
;Table name:df_goods_category
Field name | Field type | field option | Field description |
---|---|---|---|
id | IntegerField | primary_key=True | PhotoID |
name | CharField | max_length=20 | Name of commodity category |
logo | CharField | max_length=100 | Commodity category identification |
image | ImageField | upload_to=”category” | Picture of commodity category |
> commodity SKU table
- Model class name:
GoodsSKU
;Table name:df_goods_sku
Field name | Field type | field option | Field description |
---|---|---|---|
id | IntegerField | primary_key=True | PhotoID |
category | ForeignKey | The foreign key is the GoodsCategory model. | Restrict the category of the commodity |
goods | ForeignKey | The foreign key is the Goods model. | SPU that constrains the product |
name | CharField | max_length=100 | Commodity name |
title | CharField | max_length=200 | Commodity introduction |
unit | CharField | max_length=10 | Sales unit |
price | DecimalField | max_digits=10, decimal_places=2 | commodity price |
stock | IntegerField | default=0 | Commodity stock |
sales | IntegerField | default=0 | Commodity sales |
default_image | ImageField | upload_to=”goods” | Default picture of merchandise |
status | BooleanField | default=True | Whether or not to go online |
- Model class name:
IndexGoodsBanner
;Table name:df_index_goods
Field name | Field type | field option | Field description |
---|---|---|---|
id | IntegerField | primary_key=True | PhotoID |
sku | ForeignKey | The foreign key is the GoodsSKU model. | SKU that constrains the product |
image | ImageField | upload_to=”banner” | Commodity picture |
index | SmallIntegerField | default=0 | Broadcast sequence |
> home sales promotion display form
- Model class name:
IndexCategoryGoodsBanner
;Table name:df_index_category_goods
Field name | Field type | field option | Field description |
---|---|---|---|
id | IntegerField | primary_key=True | PhotoID |
name | CharField | max_length=50 | Activity name |
url | URLField | Activity link | |
image | ImageField | upload_to=”banner” | Active merchandise pictures |
index | SmallIntegerField | default=0 | Active commodity order |
order form
- Model class name:
OrderGoods
;Table name:df_order_goods
Field name | Field type | field option | Field description |
---|---|---|---|
id | IntegerField | primary_key=True | PhotoID |
order | ForeignKey | The foreign key is the OrderInfo model. | Which commodity order is the constraint? |
sku | ForeignKey | The foreign key is the GoodsSKU model. | SKU for ordering goods |
count | IntegerField | default=1 | Order quantity |
price | DecimalField | max_digits=10, decimal_places=2 | item pricing |
comment | TextField | default=”” | Evaluation information |
> model class specification.from django.db import models
from django.contrib.auth.models import AbstractUser
from utils.models import BaseModel
from django.conf import settings
from goods.models import GoodsSKU
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
class User(AbstractUser, BaseModel):
"""The user "" "Class Meta:Db_table = "df_users"Def generate_active_token (self):"""Generate activation token" ""Serializer = Serializer (settings.SECRET_KEY, 3600)Token = serializer.dumPS ({"confirm": self.id}) self.id} returns to typeReturn token.decode ()Class Address (BaseModel):"" "address" "" "User = models.ForeignKey (User, verbose_name= "user")Receiver_name = models.CharFielD (max_length=20, verbose_name= "Recipient")Receiver_mobile = models.CharField (max_length=11, verbose_n)Ame= "contact phone")Detail_addr = models.CharField (max_length=256, verbose_name= "detailed address")Zip_code = mOdels.CharField (max_length=6, verbose_name= "zip code")Class Meta:Db_table = "df_address"
from django.db import models from django.contrib.auth.models import AbstractUser from utils.models import BaseModel from django.conf import settings from goods.models import GoodsSKU from itsdangerous import TimedJSONWebSignatureSerializer as Serializer class User(AbstractUser, BaseModel): """The user "" "Class Meta:Db_table = "df_users"Def generate_active_token (self):"""Generate activation token" ""Serializer = Serializer (settings.SECRET_KEY, 3600)Token = serializer.dumPS ({"confirm": self.id}) self.id} returns to typeReturn token.decode ()Class Address (BaseModel):"" "address" "" "User = models.ForeignKey (User, verbose_name= "user")Receiver_name = models.CharFielD (max_length=20, verbose_name= "Recipient")Receiver_mobile = models.CharField (max_length=11, verbose_n)Ame= "contact phone")Detail_addr = models.CharField (max_length=256, verbose_name= "detailed address")Zip_code = mOdels.CharField (max_length=6, verbose_name= "zip code")Class Meta:Db_table = "df_address"