mardi 25 juillet 2017

how to run .py script with user input as parameters

I have a .py file, say 'car.py'. It takes 3 inputs (color, make, year). It takes the user input and reads a file, then it returns all matching instances of the color, make, and year given in the input. This script runs fine.

Now, I would like to create a web page that works like a search page. It asks for 3 inputs, searches the file (locally) and returns the results.

I am using Django for the first time and I am having difficulty figuring out how to call the car.py file and have it run on the background before it returns the result.

I have an html interface made but I know I cant ref a python script in it. Is there anything similar in Django? Where I can reference a script and when a button is pressed, it'd run that script given the user input?

I don't expect a full coded response, I just want a clarification or reference to an answer. I haven't been able to find anything similar online.




Aucun commentaire:

Enregistrer un commentaire