Answer the question
In order to leave comments, you need to log in
How to host a non-webserver script on hostings like heroku?
Hello.
I recently decided to write a "news aggregator bot" and things like that. He should email me the results every hour. The code is ready but there is a problem. Initially, I tried to make a Flask web server out of it and run it through gunicorn for later integration with heroku or any other hosting of a similar type. But I came to the conclusion that, in principle, I do not need any web muzzle, it will only interfere with work and devour the RAM. I tried to run two threads, in one the Flask server itself in the other my script, but this is a high-class crutch that will soon be covered anyway. I don’t know how the architecture of such applications is built in such cases, because heroku assumes that the script will be launched by any wsgi server immediately upon deployment, and a simple launch like 'python server.py' will immediately be put after the first development. And I would like it to hang there and not touch anyone. In fact, all bots are too small in size and memory consumption, I would not want to pay even the cheapest vds for 400 rubles a month. I feel there is some way out of the situation.
UPD
Heard about Celery and Redis broker. But then the size of the project triples. I don't think this option will work for me.
Answer the question
In order to leave comments, you need to log in
There is a VPS and for $1 in Europe, 512MB of memory, what prevents you from running the script in the background via screen ?
will immediately be laid after the first working off.
Cycle. We make a selection using the pdo\mysqli driver. After the fetch, we write the data to the fetch_assoc() array in the while loop, and in it we also write the data to .txt using file_put_contents.
The easiest option for a beginner.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question