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

Does hug.static support arguments? #512

Open
milancurcic opened this issue Jun 3, 2017 · 0 comments
Open

Does hug.static support arguments? #512

milancurcic opened this issue Jun 3, 2017 · 0 comments

Comments

@milancurcic
Copy link

milancurcic commented Jun 3, 2017

I am trying to serve static files in a directory. I followed the included examples, and this works:

import hug
@hug.static('/static')
def static():
    return ['.']

However, this does not work:

import hug
@hug.static('/static/{filename}')
def static(filename:hug.types.text):
    return ['./'+filename]

Traceback:

  File "/home/milan/venv/lib/python3.6/site-packages/hug/routing.py", line 299, in __call__
    for directory in api_function():
TypeError: static() missing 1 required positional argument: 'filename'

Is it possible to pass arguments to a hug.static-decorated function?

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

1 participant