Flask Blueprint already registered

Viewed 19

I have a flask app, (following tutorial https://www.youtube.com/watch?v=dam0GPOAvVI) - I am getting the error 'ValueError: The name 'views' is already registered for a different blueprint. Use 'name=' to provide a unique name.

init.py:

def create_app():
    app = Flask(__name__)

    from .views import views

    app.register_blueprint(views, url_prefix='/')

    return app

this is views

from flask import Blueprint

views = Blueprint('views', __name__)

 
@views.route('/')
def home():
    return '<h1>test/h1>'

my folder structure, and the main.py file I am calling.

C:.
│   main.py
│
└───website
    │   views.py
    │   __init__.py



from website import create_app
 
app = create_app()

if __name__ == "__main__":
    app.run(debug=True)

my best guess would be something along the lines of the app not un-registering the previous blueprint from the last time it was ran, but I doubt it would be something so simple. Any help would be appreciated.

0 Answers
Related