# add user
Def adduser (self, request) :
. If the request method=='GET' :
Return render (request, 'adduser. HTML)
Elif request. The method=='POST' :
# perform add data
# accept user data
The userinfo=request. POST. Dict ()
The userinfo. Pop (' csrfmiddlewaretoken ')
Myfile.=the request FILES. Get (" head_url ", None)
# file upload
If not myfile:
Return an HttpResponse (" & lt; script> Alert (' please select head '); The location. The href='& lt;/script>" )
The userinfo [' head_url]=self. Upload (myfile)
# password encryption
The userinfo [' password ']=make_password (the userinfo [' password '], None, 'pbkdf2_sha256')
Try:
# write data
User=models. The Users (* * the userinfo)
The user. The save ()
Return redirect (reverse (' myadmin_vipuser))
Except:
Return an HttpResponse (" & lt; script> Alert (' add failure! '); The location. The href='& lt;/script>" )
Like this, the method of how to make another project available, and returns the things can receive
The import rpyc
The from rpyc import Service
The from rpyc. Utils. Server import ThreadedServer
The from nameko. Standalone. RPC import ClusterRpcProxy
The from the django. HTTP import HttpResponse, JsonResponse
The import requests
The import json
Def vipuser (ruesteq) :
Pass
Def logoutuser () :
# conn. Root. Logoutuser ()
Pass
Def adduser () :
# conn. Root. Adduser ()
Pass
Def deluser () :
# conn. Root. Deluser ()
Pass
Def dellogoutuser () :
# conn. Root. Dellogoutuser ()
Pass
Def edituser () :
# conn. Root. Edituser ()
Pass
Def respwd () :
# conn. Root. Respwd ()
Pass
Def changes () :
# conn. Root. Changes ()
Pass
This is another method of the project, tried a lot of kinds of all don't know how to start, the API connection tutorial is also see don't understand, how to start
CodePudding user response:
Adduser is included in a class?Reference under the project how to invoke adduser
See if I can directly import the py files, generating an object, invoke adduser again.
CodePudding user response:
Study the conn. How root is generated,CodePudding user response:
Because I want to do is meant a micro service, remote calls to methods in another project, so the direct import that file is a bit not so good, conn. The root is that before the experiment a forgot to deleteCodePudding user response:
Don't directly use package, means directly via HTTP call?