commit/galaxy-central: dannon: Prevent uwsgi from ever loading static middleware -- it can serve static files directly with appropriate routes in its config (see wiki).
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/cca00d61df85/ Changeset: cca00d61df85 User: dannon Date: 2015-02-05 14:35:36+00:00 Summary: Prevent uwsgi from ever loading static middleware -- it can serve static files directly with appropriate routes in its config (see wiki). Affected #: 1 file diff -r 1989401bb9009e76fbaaafdeeffa68c0f12959ab -r cca00d61df85a6ecd1be49265f0c92e7482b91f9 lib/galaxy/webapps/galaxy/buildapp.py --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -86,9 +86,24 @@ # Wrap the webapp in some useful middleware if kwargs.get( 'middleware', True ): webapp = wrap_in_middleware( webapp, global_conf, **kwargs ) - if asbool( kwargs.get( 'static_enabled', True ) ): - webapp = wrap_in_static( webapp, global_conf, plugin_frameworks=[ app.visualizations_registry ], **kwargs ) - #webapp = wrap_in_static( webapp, global_conf, plugin_frameworks=None, **kwargs ) + # TEST FOR UWSGI -- TODO save this somewhere so we only have to do it once. + is_uwsgi = False + try: + # The uwsgi module is automatically injected by the parent uwsgi + # process and only exists that way. If anything works, this is a + # uwsgi-managed process. + import uwsgi + is_uwsgi = uwsgi.numproc + is_uwsgi = True + except ImportError: + # This is not a uwsgi process, or something went horribly wrong. + pass + if asbool( kwargs.get( 'static_enabled', True) ): + if is_uwsgi: + log.error("Static middleware is enabled in your configuration but this is a uwsgi process. Refusing to wrap in static middleware.") + else: + webapp = wrap_in_static( webapp, global_conf, plugin_frameworks=[ app.visualizations_registry ], **kwargs ) + #webapp = wrap_in_static( webapp, global_conf, plugin_frameworks=None, **kwargs ) if asbool(kwargs.get('pack_scripts', False)): log.warn( "The 'pack_scripts' option is deprecated" ) pack_scripts() Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org