2

I am working on a local windows web application.

I am running a RabbitMQ service and I have a python script that needs to run on the background, and consume messages from the queue (for example, using pika's basic_consume() function).

The question is - how should the program run on the backgroud. Some options:

  1. using pythonw.exe
  2. running the script as a service
  3. running an IIS site

I need the code to rerun if it fails and have a simple control of stoping and restarting it. What's the best practice?

Idan Abrashkin
  • 141
  • 2
  • 6

1 Answers1

0

The safe bet is number 2. Run your python code as a proper Windows service.

Take a look at this other SO question; using pywin32.

istepaniuk
  • 4,016
  • 2
  • 32
  • 60