code: def close(self, *args, **kwargs):
          
          super(DatabaseWrapper, self).close(*args, **kwargs)
  
          signature_version = self.settings_dict.get("SIGNATURE_VERSION", "s3v4")
          s3 = boto3.resource(
              's3',
              config=botocore.client.Config(signature_version=signature_version),
          )
  
          try:
              with open(self.settings_dict['NAME'], 'rb') as f:
                  fb = f.read()
  
                  m = hashlib.md5()
                  m.update(fb)
                  if self.db_hash == m.hexdigest():
                      logging.debug("Database unchanged, not saving to remote DB!")
                      return
  
                  bytesIO = BytesIO()
                  bytesIO.write(fb)
                  bytesIO.seek(0)
  
                  s3_object = s3.Object(self.settings_dict['BUCKET'], self.settings_dict['REMOTE_NAME'])
                  result = s3_object.put('rb', Body=bytesIO)
          except Exception as e:
              logging.debug(e)
  
          logging.debug("Saved to remote DB!")
docs: Engine closed, copy file to DB if it has changed