Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

flask subdomains

'''
All Flask's routing constructs support the subdomain keyword argument 
(this includes support for route variables).
'''


@app.route("/", subdomain="static")
def static_index():
    """Flask supports static subdomains
    This is available at static.your-domain.tld"""
    return "static.your-domain.tld"

@app.route("/dynamic", subdomain="<username>")
def username_index(username):
    """Dynamic subdomains are also supported
    Try going to user1.your-domain.tld/dynamic"""
    return username + ".your-domain.tld"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #flask #subdomains
ADD COMMENT
Topic
Name
8+3 =