@@ -164,15 +164,14 @@ def configure_uploads(app, upload_sets):
164164 """
165165 Call this after the app has been configured. It will go through all the
166166 upload sets, get their configuration, and store the configuration on the
167- app. It will also register the uploads module if it hasn't been set.
167+ app. It will also register the uploads module if it hasn't been set. This
168+ can be called multiple times with different upload sets.
168169
169170 :param app: The `~flask.Flask` instance to get the configuration from.
170171 :param upload_sets: The `UploadSet` instances to configure.
171172 """
172173 if isinstance (upload_sets , UploadSet ):
173174 upload_sets = (upload_sets ,)
174- if '_uploads' not in app .modules :
175- app .register_module (uploads_mod )
176175
177176 if not hasattr (app , 'upload_set_config' ):
178177 app .upload_set_config = {}
@@ -183,6 +182,10 @@ def configure_uploads(app, upload_sets):
183182 for uset in upload_sets :
184183 config = config_for_set (uset , app , defaults )
185184 set_config [uset .name ] = config
185+
186+ should_serve = any (s .base_url is None for s in set_config .itervalues ())
187+ if '_uploads' not in app .modules and should_serve :
188+ app .register_module (uploads_mod )
186189
187190
188191class All (object ):
0 commit comments