ValueError: Invalid blueprint name
ValueError: invalid blueprint name
$ flask run
Traceback (most recent call last):
...
ValueError: 'main/home' is not a valid blueprint name
Why this happens
Blueprint names can’t include slashes or invalid characters and must be unique across the app.
Fix
- Use simple identifiers like
main,auth,apiand avoid special characters.
Wrong code
from flask import Blueprint
bp = Blueprint('main/home', __name__) # invalid
Fixed code
from flask import Blueprint
bp = Blueprint('main', __name__)