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)




. v i e w s . r u n o o b ) .    u r l ( r t e s t d b / ‘, views.runoob),    url(r’^testdb/


. s e a r c h . s e a r c h f o r m ) .    u r l ( r s e a r c h / ‘, search.search_form),    url(r’^search/