How to link a wildcard domain to flask?
I am trying to make a website for people to create profiles, with the url for a site to be <username>.domain.com instead of domain.com/username, and so I set a wildcard CNAME record on namecheap, but when I try visiting a page, it just says "Run The Repl", unless I specifically linked that subdomain before.
I don't want to link every single useable subdomain, but when I type *.domain.com into the link domain menu it takes much longer than a just putting a subdomain.
Try something like this (replace
app with your
@app.route("/", subdomain="<username>") # now the subdomain will be passed into the parameter 'username' def profile(username): return "Hello " + username + "!"
Then you can enter
iWaroz.domain.com. The output would be
@OneNose The problem isn't with detecting the subdomain, but getting traffic from all subdomains to the repl, but I talked with a replit dev and turns out the problem is with the dns servers. Otherwise, I didn't know about the subdomain="" argument in flask which is better than my regex-based solution with flask.request.url