Skip to content

Commit

Permalink
add BASE_IMAGE_URL in .env
Browse files Browse the repository at this point in the history
  • Loading branch information
tkdwns414 committed Aug 17, 2023
1 parent 409c0ba commit d6be83f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ DEBUG=

# Oauth
BASE_URL=
BASE_IMAGE_URL=
BASE_API_URL=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
Expand Down
1 change: 1 addition & 0 deletions backback/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,4 @@

BASE_URL = os.getenv("BASE_URL")
BASE_API_URL = os.getenv("BASE_API_URL")
BASE_IMAGE_URL = os.getenv("BASE_IMAGE_URL")
4 changes: 2 additions & 2 deletions community/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_image(self, instance):
if instance.images.count() == 0:
return None
url = instance.images.first().image.url
return settings.BASE_URL + url # 밑이랑 달라요, url 쓰면 media 딸려서 나옴
return settings.BASE_IMAGE_URL + url # 밑이랑 달라요, url 쓰면 media 딸려서 나옴


class PostDetailSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -109,7 +109,7 @@ def get_is_liked(self, instance):
def get_images(self, obj):
images = obj.images.all()
image_urls = [
settings.BASE_URL + settings.MEDIA_URL + str(image.image)
settings.BASE_IMAGE_URL + settings.MEDIA_URL + str(image.image)
for image in images
]
return image_urls
Expand Down

0 comments on commit d6be83f

Please sign in to comment.