talkpython/100daysofweb-with-python-course

Day 24 - does not work with Flask 2.x

CaptSolo opened this issue · 3 comments

flask run in the folder 021-024-quart-async/your_turn/day_4/cityscape_api/ fails with an error if using a recent version of Flask (v2.0.2) installed from requirements.txt:

  File "/Users/captsolo/Documents/021-024-quart-async/your_turn/day_4/cityscape_api/app.py", line 2, in <module>
    from views import city_api
  File "/Users/captsolo/Documents/021-024-quart-async/your_turn/day_4/cityscape_api/views/city_api.py", line 4, in <module>
    blueprint = flask.blueprints.Blueprint(__name__, __name__)
  File "/Users/captsolo/Documents/021-024-quart-async/your_turn/venv/lib/python3.7/site-packages/flask/blueprints.py", line 197, in __init__
    raise ValueError("'name' may not contain a dot '.' character.")
ValueError: 'name' may not contain a dot '.' character.

The error does not appear if Flask is pinned to an earlier version (e.g. flask==1.1.2).

Thanks @CaptSolo, interesting, @mikeckennedy should we pin requirements? (might apply to other lessons as well)

Thank you @bbelderbos and @CaptSolo. I just fixed it and one other issue I uncovered while revisiting this section. Bob, I don't think pinning is the best fix here. I updated the code to work on Flask 2.0+ which will give everyone a better idea on how to keep working with the latest Flask. :)