python(view.py)
import json from django.shortcuts import render,HttpResponse from .models import Wheel, Nav, Mustbuy, Shop, Mainshow, FoodTypes, Goods # Create your views here. def home(request): print("HOME@@@@@@@@@@@@@@@@@@"); request.encoding = 'utf-8' #处理android端请求 if "param" in request.GET: info = request.GET["param"] print(info) response_data = {} response_data['result'] = 'zhuliqin' response_data['message'] = 'xihuanshaoshijiao' return HttpResponse(json.dumps(response_data)) # str = json.dumps("hello") # print(str) # return HttpResponse(str) else: wheelsList = Wheel.objects.all() navList = Nav.objects.all() mustbuyList = Mustbuy.objects.all() shopList = Shop.objects.all() shop1 = shopList[0] shop2 = shopList[1:3] shop3 = shopList[3:7] shop4 = shopList[7:11] mainList = Mainshow.objects.all() return render(request,'axf/home.html',{ "title":"主页","wheelsList":wheelsList,"navList":navList,"mustbuyList":mustbuyList,