Use 2 docker containers for bot and webservice
This commit is contained in:
25
webservice/app.py
Normal file
25
webservice/app.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import multiprocessing as mp
|
||||
import time
|
||||
|
||||
from flask import Flask
|
||||
|
||||
from telegram_bot.bot import bot
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def hello_world():
|
||||
return 'Hello World!'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
proc1 = mp.Process(target=app.run, args=())
|
||||
proc1.start()
|
||||
|
||||
while True:
|
||||
try:
|
||||
bot.polling(none_stop=True)
|
||||
except Exception as e:
|
||||
print(f"[EXCEPTION] {e}")
|
||||
time.sleep(15)
|
||||
Reference in New Issue
Block a user