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
StaticFiles support for directories other than "statics" #1265
Comments
That's already supported. Check the docs here: https://www.starlette.io/staticfiles/ |
I don’t think it is. I want to use the |
@bram2000 yes, I don't know why this directory is hard-coded. There is also a copy/paste issue in the following assert message:
|
@stephane |
@HanDDol oh, you're right! How could I have missed it? 🤣 |
I found that by simply creating an empty directory called |
Hi folks, we're considering #1350 and the following API to address this use case… routes=[
...
Mount('/static', app=StaticFiles(packages=['bootstrap4', ('mypackage', 'dist')]), name="static"),
] That is, we'll be able to specify a root directory to look into as a 2-tuple Any thoughts or comments welcome on the PR before we move on and merge. :-) |
Checklist
Is your feature related to a problem? Please describe.
I want to be able to serve static files from arbitrary locations within a python package but I can't because currently it looks in a
statics
folder which is hardcoded.Describe the solution you would like.
I'd like to be able to pass as a parameter the path within the python package to look in for the static files.
Describe alternatives you considered
I've considered changing the location of my packaged files to
statics
but this will have knock on effects across other systems, andstatics
itself is non-standard as far as I can tell.Additional context
The text was updated successfully, but these errors were encountered: