In our previous project to create a search. Py files, download netease cloud classroom: Vue + Django independent development of electrical business project used to receive the user’s request: / HelloWorld/HelloWorld/search. Py file code: From Django. HTTP import HttpResponsefrom Django. shortcuts import render# form def search_form(request): return render(request, ‘search_form.html’)
Def search(request):
Request. Encoding =’ utF-8 ‘if ‘q’ in request.GET and request.GET[‘q’]: message =’ + request.GET[‘q’] else: Return HttpResponse(message) Add the search_form.html form to the templates directory: / HelloWorld/templates/search_form. HTML file code: novice tutorial (runoob.com)