Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_bucket_name_and_resource_uri(self):
# generate bucket_name
if 'development' in os.getenv('DJANGO_SETTINGS_MODULE'):
bucketname = development.MINIO_STORAGE_COG_BUCKET_NAME
else:
bucketname = production.MINIO_STORAGE_COG_BUCKET_NAME
# generate uri from minio
if 'development' in os.getenv('DJANGO_SETTINGS_MODULE'):
minio_baseurl = development.MINIO_STORAGE_COG_URL
else:
minio_baseurl = production.MINIO_STORAGE_COG_URL
uri = urljoin(
minio_baseurl,
os.path.join(bucketname, self.name)
)
COG.objects.filter(
id=self.id
).update(
bucket_name=bucketname,
resource_uri=uri
)
def set_bucket_name_and_resource_uri(self):
# generate bucket_name
if 'development' in os.getenv('DJANGO_SETTINGS_MODULE'):
bucketname = development.MINIO_STORAGE_COG_BUCKET_NAME
else:
bucketname = production.MINIO_STORAGE_COG_BUCKET_NAME
# generate uri from minio
if 'development' in os.getenv('DJANGO_SETTINGS_MODULE'):
minio_baseurl = development.MINIO_STORAGE_COG_URL
else:
minio_baseurl = production.MINIO_STORAGE_COG_URL
uri = urljoin(
minio_baseurl,
os.path.join(bucketname, self.name)
)
COG.objects.filter(
id=self.id
).update(
bucket_name=bucketname,
resource_uri=uri
)