from flask import Flaskapp = Flask(__name__)@app.route('/')def index(): return 'This is the main domain.'@app.route('/', subdomain='<subdomain>')def subdomain(subdomain): return f'This is the subdomain: {subdomain}'if __name__ == '__main__': app.run(debug=True)
this doesnt work i run it locally and localhost:5000 gives main and sub.localhost:5000 gives main not sub so, i add this to hosts file:
127.0.0.1 sub.localhost
but it didnt work it still just opens sub.localhost:5000 and shows main not sub and i tried hosting services like render and it gives error and ngrok tunnel from localhost gives error,how do i use subdomains and have them actually work??
so like how to make it work locally, and using tunnel services like ngrok and using hosting services like render