Ask coding questions

← Back to all posts
How to get nested domains (i'm not sure what its called) in flask?
mordyman (4)

If I have a flask application such as

from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
  return 'hello'

which is running on myapp.com for arguments sake
how can I make the code also serve requests to chat.myapp.com

Answered by BD103 (139) [earned 5 cycles]
View Answer
Comments
hotnewtop
BD103 (139)

The Flask server does not handle subdomains. A subdomain points the client to a different web server, so Flask cannot adjust this. I do not believe there is a way to get sub-subdomains in Replit. If you happen to own myapp.com, then go to the domain management dashboard (GoDaddy or Google domains or something else) and do something there. Once you've done that, you can click the pencil in replit and follow the instructions like @ch1ck3n said.

mordyman (4)

Ok thanks so much! @BD103

BD103 (139)

Glad I could help! :P
@mordyman

ch1ck3n (2088)

click on the pencil icon at the window avobe the console and do what it says

mordyman (4)

I mean i want it to use the same data that myapp.com has without rewriting everything also I don't mean specifically on repl @ch1ck3n