Using subdomains for dashboard!

Hello, I’ve been trying to add a dashboard to my app but my attempts have been unsuccessful.
This is what I had at the moment my-domain,com/ and my-domain,com/dashboard/ for the dashboard but I’ve been wanting to convert it to a subdomain so dashboard.my-domain,com/
but its not working?
I’ve connected my domain: www.my-domain,com, my-domain,com, *.my-domain,com

@app.route("/")
def root():
    return "root"

@app.route('/', subdomain='dashboard')
def dashboard():
    return "dashboard"

but going to both my-domain.com and dashboard.my-domain,com give “root”, did I mess something up?

Thanks!
(also sorry about like doing , and not . in links i hope im not breaking the rules, it just wasnt letting me post and i thought there would be no harm in adding , because they werent real domains)

Hi there,

I believe that for this to work, you need to set SERVER_NAME so Flask knows what your main domain is.

Regards,

Keith
Render Support, UTC+10 :australia:

1 Like

Setting my server name to my domain

app.config['SERVER_NAME'] = 'my-domain.com'

worked.
Thank you Keith!!