Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the landing page to root / #15

Open
pasqLisena opened this issue May 15, 2020 · 2 comments
Open

Set the landing page to root / #15

pasqLisena opened this issue May 15, 2020 · 2 comments
Assignees

Comments

@pasqLisena
Copy link
Contributor

When I try to setup swagger to serve the UI from root / (rather than /api/docs):

api_doc(app, config_path='swagger.yml', url_prefix='', title='API title')

I get the following error:

Traceback (most recent call last):
  File "app/run.py", line 1, in <module>
    from project import app
  File "/Users/pasquale/git/ted-talk-topic-extraction/app/project.py", line 16, in <module>
    api_doc(app, config_path='swagger.yml', url_prefix='/', title='Topic Model API')
  File "/usr/local/lib/python3.7/site-packages/swagger_ui/old.py", line 25, in __init__
    super(FlaskInterface, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/swagger_ui/core.py", line 33, in __init__
    getattr(self, '_{}_handler'.format(app_type))()
  File "/usr/local/lib/python3.7/site-packages/swagger_ui/core.py", line 142, in _flask_handler
    self._app.register_blueprint(swagger_blueprint)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 98, in wrapper_func
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1168, in register_blueprint
    blueprint.register(self, options, first_registration)
  File "/usr/local/lib/python3.7/site-packages/flask/blueprints.py", line 257, in register
    deferred(state)
  File "/usr/local/lib/python3.7/site-packages/flask/blueprints.py", line 295, in <lambda>
    self.record(lambda s: s.add_url_rule(rule, endpoint, view_func, **options))
  File "/usr/local/lib/python3.7/site-packages/flask/blueprints.py", line 87, in add_url_rule
    **options
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 98, in wrapper_func
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1275, in add_url_rule
    rule = self.url_rule_class(rule, methods=methods, **options)
  File "/usr/local/lib/python3.7/site-packages/werkzeug/routing.py", line 666, in __init__
    raise ValueError("urls must start with a leading slash")
ValueError: urls must start with a leading slash
@PWZER PWZER added the bug Something isn't working label May 15, 2020
@PWZER PWZER self-assigned this May 15, 2020
@CMCDragonkai
Copy link

I don't get this with aiohttp. But I get a different error #22

@PWZER
Copy link
Owner

PWZER commented Sep 27, 2021

@pasqLisena This is Flask requirements, you should set url_prefix non-empty, It has nothing to do with this project.

@PWZER PWZER removed the bug Something isn't working label Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants