Skip to content

Commit

Permalink
fix : 실행코드 수정, 주석 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
sycuuui committed Mar 22, 2024
1 parent 0821e00 commit 1934130
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: |
# 프로젝트 실행 명령어 또는 스크립트를 실행
# 예를 들어, Flask 앱 실행:
python app.py # 이 부분을 프로젝트 실행하는 명령어 또는 스크립트로 대체해야 함
#python app.py # 이 부분을 프로젝트 실행하는 명령어 또는 스크립트로 대체해야 함
# Docker 빌드 & 푸시
- name: Docker build & push
Expand Down
32 changes: 16 additions & 16 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask import (Flask, jsonify)
# from connection import s3_connection
# import os
from connection import s3_connection
import os

app = Flask(__name__)

Expand All @@ -22,20 +22,20 @@ def test2(): # put application's code here
def test3(): # put application's code here
return 'post test3'

# @app.route('/image', methods=['POST'])
# def test_image():
# s3 = s3_connection()
# try:
# with open('dd.jpeg', 'rb') as image_file:
# s3.put_object(
# Bucket=os.getenv('BUCKET_NAME'),
# Body=image_file,
# Key='dd.jpeg',
# ContentType='image/jpeg'
# )
# return jsonify({'success': True})
# except Exception as e:
# return jsonify({'error': str(e)})
@app.route('/image', methods=['POST'])
def test_image():
s3 = s3_connection()
try:
with open('dd.jpeg', 'rb') as image_file:
s3.put_object(
Bucket=os.getenv('BUCKET_NAME'),
Body=image_file,
Key='dd.jpeg',
ContentType='image/jpeg'
)
return jsonify({'success': True})
except Exception as e:
return jsonify({'error': str(e)})

if __name__ == '__main__':
app.run(host='0.0.0.0', port='5000')
18 changes: 9 additions & 9 deletions connection.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# import boto3
# import os
#
#
# def s3_connection():
# s3 = boto3.client('s3',
# aws_access_key_id=os.getenv('AWS_ACCESS_KEY'),
# aws_secret_access_key=os.getenv('AWS_SECRET_KEY'))
# return s3
import boto3
import os


def s3_connection():
s3 = boto3.client('s3',
aws_access_key_id=os.getenv('AWS_ACCESS_KEY'),
aws_secret_access_key=os.getenv('AWS_SECRET_KEY'))
return s3

0 comments on commit 1934130

Please sign in to comment.