StaticFiles support for directories other than "statics"
See original GitHub issueChecklist
- [/] There are no similar issues or pull requests for this yet.
- [X - tried to get feedback but no replies] I discussed this idea on the community chat and feedback is positive.
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, and statics
itself is non-standard as far as I can tell.
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Django created staticfiles folder rather than static folder
First it collect static files from STATICFILES_DIRS if any, if there is no STATICFILES_DIRS in settings it collects static files from each app ......
Read more >Static files in ASP.NET Core | Microsoft Learn
Static files, such as HTML, CSS, images, and JavaScript, are assets an ASP.NET Core app serves directly to clients by default. Serve static...
Read more >How to manage static files (e.g. images, JavaScript, CSS)
Set the STATIC_ROOT setting to the directory from which you'd like to serve these files, for example: STATIC_ROOT = "/var/www/example.com/static/" · Run the ......
Read more >How to setup static files in Django - PythonAnywhere help
... if you want to use a static URL prefix other than /static/ ... in settings.py defines the single folder you want to...
Read more >Static Files - FastAPI
You can serve static files automatically from a directory using StaticFiles . ... All these parameters can be different than " static ",...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi folks, we’re considering #1350 and the following API to address this use case…
That is, we’ll be able to specify a root directory to look into as a 2-tuple
(<package_name>, <dir>)
form, where the single string"<package_name>"
uses the current default,"statics"
.Any thoughts or comments welcome on the PR before we move on and merge. 😃
I found that by simply creating an empty directory called
statics
inside the dependancy this then worked and seemed to allow me to reference things instatic
within the dependancy. This feels like bug to me and as @bram2000 said, would be helpful if you could pass a parameter specifying the directory within a dependancy you need to include things from.