votes up 3

'endpoint' may not contain a dot '.' character.

Package:
flask
github stars 56479
Exception Class:
ValueError

Raise code

        view_func: t.Optional[t.Callable] = None,
        **options: t.Any,
    ) -> None:
        """Like :meth:`Flask.add_url_rule` but for a blueprint.  The endpoint for
        the :func:`url_for` function is prefixed with the name of the blueprint.
        """
        if endpoint and "." in endpoint:
            raise ValueError("'endpoint' may not contain a dot '.' character.")

        if view_func and hasattr(view_func, "__name__") and "." in view_func.__name__:
            raise ValueError("'view_func' name may not contain a dot '.' character.")

        self.record(lambda s: s.add_url_rule(rule, endpoint, view_func, **options))

    def app_template_filter(self, name: t.Optional[str] = None) -> t.Callable:
😲  Walkingbet is Android app that pays you real bitcoins for a walking. Withdrawable real money bonus is available now, hurry up! 🚶

Ways to fix

votes up 1 votes down

Summary

Endpoints in flasks add_url_rule method must not contain dot '.' characters.

Reproduce

from flask import Flask
app = Flask(__name__)

def i():
    return ""

app.add_url_rule("/", view_func=i, endpoint="index.html")

app.run()

Fix

from flask import Flask
app = Flask(__name__)

def i():
    return ""

app.add_url_rule("/", view_func=i, endpoint="index") #<-- endpoint must not have a dot '.' character

app.run()
May 29, 2021 cRyp70s answer
cRyp70s 113

Add a possible fix

Please authorize to post fix