-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Disable STATIC_URL ? #108
Comments
That's a good question. But first, is there a reason why you want Flask to serve them directly? If you need to do anything with them in your code before serving them, they wouldn't really be static. Check the Flask docs, they recommend having your server serve the static files and using Flask to serve them directly only during development: http://flask.pocoo.org/docs/1.0/quickstart/#static-files If you need to use Jinja2 templates, that should go into the If you need to serve files that somehow you need to read in your Python code first and then serve them (for example, you need to authenticate the user first), you shouldn't put them on |
I'll be the first to admit that my usecase is not entirely normal, but for a number of business reasons, I'm choosing to drive all requests directly through flask, to allow the highest amount of flexibility in the future. One reason is the ability to place static assets at any path easily. |
Sorry for the delay! I was busy building FastAPI. I see... actually, there is currently no official way to disable That would allow you to have a completely custom Would that work for your use case? |
I just added a lot of tests for all the images, configurations, env vars, etc. To be able to refactor them knowing that I'm not breaking anything. I'm thinking about refactoring it to allow providing a file in Also, I just created a couple of alternative images with better performance and no default static serving. You might want to check them in the updated README. They might do what you need right now. |
I will try that next time I'm in for a refactor with this client. Thanks! |
I just finished a big refactor to be able to add this feature on top. You can now add a file You can check the docs here: https://github.com/tiangolo/uwsgi-nginx-flask-docker#overriding-nginx-configuration-completely |
Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues. |
Hello,
I'd like to route all my static assets through flask. Is there a way to stop the functionality provided by
STATIC_URL
? Currently, I have it set in my dockerfile to a long random string, effectively disabling it (since this string would never be reached on the frontend), but this feels like a hack.Is there a better solution?
The text was updated successfully, but these errors were encountered: