You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sanic is installed in a virutalenv. Within the Chapter02/booktracker folder, I issue this command at the Windows Command prompt:
sanic src.server:app -p 7777 --debug --workers=2
I get this traceback:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Program Files\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\Scripts\sanic.exe_main.py", line 7, in
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic_main.py", line 12, in main
cli.run()
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\cli\app.py", line 82, in run
app = self._get_app()
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\cli\app.py", line 135, in get_app
module = import_module(module_name)
File "C:\Program Files\Python310\lib\importlib_init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\Chapter02\booktracker\src\server.py", line 4, in
app = create_app()
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\Chapter02\booktracker\src\utilities\app_factory.py", line 22, in create_app
autodiscover(app, *init_blueprints)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\Chapter02\booktracker\src\utilities\autodiscovery.py", line 28, in autodiscover
app.blueprint(bp)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\app.py", line 527, in blueprint
blueprint.register(self, options)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\blueprints.py", line 357, in register
route = app._apply_route(apply_route)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\app.py", line 393, in _apply_route
routes = self.router.add(**params)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\router.py", line 137, in add
route = super().add(**params) # type: ignore
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic_routing\router.py", line 243, in add
group.merge(existing_group, overwrite, append)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic_routing\group.py", line 160, in merge
raise RouteExists(
sanic_routing.exceptions.RouteExists: Route already registered: book [GET]
The text was updated successfully, but these errors were encountered:
Thanks for bringing this up! This looks like it is the result of a change between v21.3 and v21.6 (when the chapter was written). Basically what is happening is the autodiscover is trying to load both the Blueprint and the BlueprintGroup.
I will get a correction for this up probably later today.
sanic is installed in a virutalenv. Within the Chapter02/booktracker folder, I issue this command at the Windows Command prompt:
sanic src.server:app -p 7777 --debug --workers=2
I get this traceback:
Traceback (most recent call last):
File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Program Files\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\Scripts\sanic.exe_main.py", line 7, in
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic_main.py", line 12, in main
cli.run()
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\cli\app.py", line 82, in run
app = self._get_app()
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\cli\app.py", line 135, in get_app
module = import_module(module_name)
File "C:\Program Files\Python310\lib\importlib_init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\Chapter02\booktracker\src\server.py", line 4, in
app = create_app()
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\Chapter02\booktracker\src\utilities\app_factory.py", line 22, in create_app
autodiscover(app, *init_blueprints)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\Chapter02\booktracker\src\utilities\autodiscovery.py", line 28, in autodiscover
app.blueprint(bp)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\app.py", line 527, in blueprint
blueprint.register(self, options)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\blueprints.py", line 357, in register
route = app._apply_route(apply_route)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\app.py", line 393, in _apply_route
routes = self.router.add(**params)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic\router.py", line 137, in add
route = super().add(**params) # type: ignore
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic_routing\router.py", line 243, in add
group.merge(existing_group, overwrite, append)
File "D:\Development\PyCharmProjects\Python-Web-Development-with-Sanic-main\venv\lib\site-packages\sanic_routing\group.py", line 160, in merge
raise RouteExists(
sanic_routing.exceptions.RouteExists: Route already registered: book [GET]
The text was updated successfully, but these errors were encountered: