I need collect statics for different moduls in one place. Then to give this static to nginx from one place. Maybe it has already been implemented?
-
You probably don't need this, unless you're building the next facebook, or serve really huge files (next dropbox?). The overhead of invoking a thin layer of Python code when serving a static file is most likely absolutely negligible for your application. I'm finding Django's approach of insisting on not serving static assets in production quite annoying. YAGNI :) – Sergey Jul 08 '14 at 20:21
-
@Sergey I really need it. In the project a lot of applications and a lot of static. Therefore looking for a solution. Statics is given through nginx, so i need something to collect it in one place. I was advised that's the solution - [webassets](http://webassets.readthedocs.org/en/latest/) – Greg Eremeev Jul 08 '14 at 21:32
1 Answers
Pyramid does not provide such a feature since it is not a convention-over-configuration framework. But there are a couple of ways to customize static asset URL generation for development and production environments. There is a newer configuration media_location
that you could explore.
To create such a circumstance, we suggest using the pyramid.registry.Registry.settings API in conjunction with a setting in the application .ini file named media_location. Then set the value of media_location to either a prefix or a URL depending on whether the application is being run in development or in production (use a different .ini file for production than you do for development). This is just a suggestion for a pattern; any setting name other than media_location could be used.

- 3,303
- 20
- 30
-
>Pyramid does not provide such a feature since it is no convention-over-configuration framework. I found a helper module - [van.static](https://pypi.python.org/pypi/van.static/1.3) – Greg Eremeev Jul 08 '14 at 14:20
-
-