If your code needs to initiate the connection to the robot, your Django “server” is the “client” to the robot.
You don’t need to add the client code, you need to remove the server code and replace it with the client code to initiate the connection to the robot.
Forget Django for the moment - do you have any working Python code to communicate with the robot? If so, please post it here.