Commodity 5 - Commodity Module

5- Commodity Module

---Restore content begins---

Product home page

The front-end page rendering of the product home page is as follows:

Business logic processing of backend view:

According to the page displayed by the front end, the data that the back end needs to transmit to the front end are:

  1 The data that the backend needs to transmit to the front end includes
  2. All product category information
  3. Carousel data
  4. Advertisement information
  5. Title and picture of classified product display
  6. User shopping cart information

The code of the view IndexView function is as follows:

  View Code

 

 The code to be filled in the product classification of the front-end template is as follows:

  View Code

 

 The code to be filled in the front-end template carousel is as follows:

  View Code

 The code to be filled in the front-end template event ad is as follows:

  View Code

 

 The code to be filled in the front-end template product category display is as follows:

  View Code

 Because it is rendered in the template, and the static file is actually in staic, it is said that this paragraph should be added to the front-end index code:

  View Code

 

 

You can judge whether the user is logged in in the front end. If the login appears to welcome the visit, if not, it is login and registration

1
2
3
4
5
6
7
8
9
10
11
12
13
{% if user.is_authenticated %}
    < div  class="login_btn fl">
          欢迎您:< em >{{ user.username }}</ em >
     < span >|</ span >
     < a  href="{% url 'users:logout' %}">退出</ a >
    </ div >
  {% else %}
     < div  class="login_btn fl">
     < a  href="{% url 'users:login' %}">登录</ a >
     < span >|</ span >
     < a  href="{% url 'users:register' %}">注册</ a >
    </ div >
{% endif %}

Enter in the browser, you can display the information filled in the backend

Enter http://127.0.0.1:8000 on the webpage and then start the distributed asynchronous server: (the first two are to enable distributed, the latter one to enable asynchronous) 
sudo service fdfs_trackerd start
sudo service fdfs_storaged start
sudo /usr/local/nginx/ sbin/nginx

will appear:

 

 

 

---Restore content begins---

Product home page

The front-end page rendering of the product home page is as follows:

Business logic processing of backend view:

According to the page displayed by the front end, the data that the back end needs to transmit to the front end are:

  1 The data that the backend needs to transmit to the front end includes
  2. All product category information
  3. Carousel data
  4. Advertisement information
  5. Title and picture of classified product display
  6. User shopping cart information

The code of the view IndexView function is as follows:

  View Code

 

 The code to be filled in the product classification of the front-end template is as follows:

  View Code

 

 The code to be filled in the front-end template carousel is as follows:

  View Code

 The code to be filled in the front-end template event ad is as follows:

  View Code

 

 The code to be filled in the front-end template product category display is as follows:

  View Code

 Because it is rendered in the template, and the static file is actually in staic, it is said that this paragraph should be added to the front-end index code:

  View Code

 

 

You can judge whether the user is logged in in the front end. If the login appears to welcome the visit, if not, it is login and registration

1
2
3
4
5
6
7
8
9
10
11
12
13
{% if user.is_authenticated %}
    < div  class="login_btn fl">
          欢迎您:< em >{{ user.username }}</ em >
     < span >|</ span >
     < a  href="{% url 'users:logout' %}">退出</ a >
    </ div >
  {% else %}
     < div  class="login_btn fl">
     < a  href="{% url 'users:login' %}">登录</ a >
     < span >|</ span >
     < a  href="{% url 'users:register' %}">注册</ a >
    </ div >
{% endif %}

Enter in the browser, you can display the information filled in the backend

Enter http://127.0.0.1:8000 on the webpage and then start the distributed asynchronous server: (the first two are to enable distributed, the latter one to enable asynchronous) 
sudo service fdfs_trackerd start
sudo service fdfs_storaged start
sudo /usr/local/nginx/ sbin/nginx

will appear:

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324614338&siteId=291194637