Skip to content

Commit

Permalink
Add error message for login manager
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbaldwin44 committed Sep 13, 2024
1 parent 7c85b79 commit 1f4fcc9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ def __init__(
# ensures static js files work on Windows
mimetypes.add_type("application/javascript", ".js")

if self.web_login:
self.login_manager = LoginManager()
self.login_manager.init_app(app)
self.login_manager.login_view = "login"

if environment.runner:
self.update_template_args()
if not delayed_start:
Expand Down Expand Up @@ -518,6 +513,16 @@ def update_user():

return {}, 201

@property
def login_manager(self):
if self.web_login:
login_manager = LoginManager()
login_manager.init_app(self.app)
login_manager.login_view = "login"
return login_manager

raise AttributeError("The login_manager is only available with --web-login.\n")

def start(self):
self.greenlet = gevent.spawn(self.start_server)
self.greenlet.link_exception(greenlet_exception_handler)
Expand Down

0 comments on commit 1f4fcc9

Please sign in to comment.