I’m writing discord bot with python 3 in glitch. I use flask to open the bot. server.py is my main file. The boot starts from there. I added the flask section in the main file to the text.
My problem is: if name == ‘__main __’: ‘Hello world’ is written on the page but the bot does not open. if name == ‘__server (main filename) __’: When you do, the page stays on ‘Starting …’ and the bot opens. What should I do to open the bot and have that page? My goal is to ask the page to open, I use UptimeRobot to make the bot 24/7.
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
if __name__ == '__main__':
app.run(port=int(os.getenv('PORT', 5000)))