diff --git a/specifyweb/attachment_gw/views.py b/specifyweb/attachment_gw/views.py index 29eeeb67225..a1bbfaa9de0 100644 --- a/specifyweb/attachment_gw/views.py +++ b/specifyweb/attachment_gw/views.py @@ -66,8 +66,11 @@ def get_collection(request=None): # do any better than using the first collection # and hoping that all the assets are in the same # folder. - from specifyweb.specify.models import Collection - return Collection.objects.all()[0].collectionname + # from specifyweb.specify.models import Collection + # return Collection.objects.all()[0].collectionname + + # The default coll parameter to assets is the database name + return settings.DATABASE_NAME @openapi(schema={ "get": { diff --git a/specifyweb/settings/specify_settings.py b/specifyweb/settings/specify_settings.py index 88cea0dccc4..80fbd59b6cc 100644 --- a/specifyweb/settings/specify_settings.py +++ b/specifyweb/settings/specify_settings.py @@ -32,7 +32,7 @@ WEB_ATTACHMENT_KEY = None # The collection name to use with the web attachment server. -WEB_ATTACHMENT_COLLECTION = None +WEB_ATTACHMENT_COLLECTION = os.environ.get('WEB_ATTACHMENT_COLLECTION', DATABASE_NAME) or DATABASE_NAME # If True, and WEB_ATTACHMENT_COLLECTION is None, attachments for each # collection would be stored in separate folders