Answer the question
In order to leave comments, you need to log in
How to call a function from views.py file (django)?
The idea is the following: on the html page there is a form with an input tag and a text attribute. There are several such fields. When the "send" button is pressed, all the data entered by the user in an array goes to the server in the views.py file, in which the external (request) function:
def external(request):
global z
z = request.POST.getlist("items")
run([sys.executable, 'C://Users//support//PycharmProjects//untitled//project//main//codetest.py'])
return render(request, 'main/test.html')
def test():
external()
tuplez = tuple(z)
Answer the question
In order to leave comments, you need to log in
Solved the problem as follows: Added variable z
to run([sys.executable, 'C://Users//support//PycharmProjects//untitled//project//main//codetest.py', str (z)]) , which takes on an array.
Called this variable as an argument in the script: x = "%s" % (sys.argv[1]).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question