python - Flask exception "View function mapping is overwriting an existing endpoint function" -


i'm following book called: "flask web development".

when i'm creating login system creates can exception @ registration of blueprint have made.

log:

    c:\python27\python.exe "c:/users/bo/google drev/privat/hobbyprojekter/event/manage.py" traceback (most recent call last):   file "c:/users/bo/google drev/privat/hobbyprojekter/event/manage.py", line 7, in <module>     app = create_app(os.getenv('flask_config') or 'default')   file "c:\users\bo\google drev\privat\hobbyprojekter\event\app\__init__.py", line 42, in create_app     app.register_blueprint(auth_blueprint, url_prefix='/auth')   file "c:\python27\lib\site-packages\flask\app.py", line 62, in wrapper_func     return f(self, *args, **kwargs)   file "c:\python27\lib\site-packages\flask\app.py", line 889, in register_blueprint     blueprint.register(self, options, first_registration)   file "c:\python27\lib\site-packages\flask\blueprints.py", line 153, in register     deferred(state)   file "c:\python27\lib\site-packages\flask\blueprints.py", line 172, in <lambda>     s.add_url_rule(rule, endpoint, view_func, **options))   file "c:\python27\lib\site-packages\flask\blueprints.py", line 76, in add_url_rule     view_func, defaults=defaults, **options)   file "c:\python27\lib\site-packages\flask\app.py", line 62, in wrapper_func     return f(self, *args, **kwargs)   file "c:\python27\lib\site-packages\flask\app.py", line 984, in add_url_rule     'existing endpoint function: %s' % endpoint) assertionerror: view function mapping overwriting existing endpoint function: auth.login 

the code register blueprint looks this:

from .auth import auth auth_blueprint app.register_blueprint(auth_blueprint, url_prefix='/auth') 

and code imports auth__init__.py :

from flask import blueprint  auth = blueprint('auth', __name__)  . import views flask import render_template . import auth  @auth.route('/login') def login():     return render_template('auth/login.html') 

at last view i'm trying register (just snippet):

@auth.route('/login', methods=['get', 'post']) def login(): 

hope can help

you have 2 endpoints called '/login'. change 1 of names. functions can't have same names either.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -