Skip to content

Instantly share code, notes, and snippets.

@rashivkp
Created February 21, 2019 12:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rashivkp/4489f62884f710731576cb236b90d27c to your computer and use it in GitHub Desktop.
Save rashivkp/4489f62884f710731576cb236b90d27c to your computer and use it in GitHub Desktop.
return helloworld for every route
from flask import Flask
from werkzeug.routing import BaseConverter
app = Flask(__name__)
class RegexConverter(BaseConverter):
def __init__(self, url_map, *items):
super(RegexConverter, self).__init__(url_map)
self.regex = items[0]
app.url_map.converters['regex'] = RegexConverter
@app.route('/<regex(".*"):uid>/')
def hello(uid):
return "Hello World!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment