P
P
patsanchique2020-08-31 23:51:20
Python
patsanchique, 2020-08-31 23:51:20

How to locally execute a python script from a web page?

I have a form on my site through which users send data, if the data is valid, then you need to execute a script on my local PC that processes this data. I imagined it like this: write the entered data to the database, and listen to the database for changes with a local script, and then execute the code, but, as I understand it, this is far from the best idea. How can this task be accomplished?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
necrodeflorator, 2020-08-31
@patsanchique

RabbitMQ

I
iddqda, 2020-09-01
@iddqda

I'm not a real programmer, it's just that I'm playing around, you can say it's a hobby,
so I don't know modern practices, but IMHO RabbitMQ is something quite ancient and too powerful
. I solved a similar problem using Redis and RQ
instead of RQ with python, they still use celery, but it more complicated
Everything is very simple, your web server connects to Redis and places a task in it, returning a job_id
RQ takes the task for execution and assigns it to a free worker
Tasks are just Python functions that are described in a separate file
The server knowing the job_id can pull RQ and to receive the task execution status
But he certainly will not pull anything. But must provide such a function to the client.
Well, if you need interactivity.
work with RQ is well described here: https://habr.com/en/post/354752/
As a bonus, you can add any relatively static content in Redis.
For example, graphs that are calculated on demand

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question