Posts
- Q&A - capl ์ฝ๋ ์์ฑ & ์ฝ๋ ๋ถ๋ฌ์ค๊ธฐ ๊ด๋ จ ์ง๋ฌธ์ ๋๋ค. - ์์ฑ์ ์ญ์ ๋ฅผ ๋๋ ๋๋ฐ, ๊ณ์ ๋จ์ ์์ด์ ๋จ๊น๋๋ค. 'write' ์ฐฝ ๋ฐ์ ์ฌ๋ฌ ํญ์ด ์กด์ฌํ๋ ๊ฒ์ ๋ค๋ฆ๊ฒ ๋ฐ๊ฒฌํ์ต๋๋ค;; ๊ฐ์ ๋ด์ฉ๋๋ก ์ ์๋ํฉ๋๋ค. - 1
- 2
- 139
 
- Q&A - [Q : ์น์ 3. flask + redis ์๋น์ค ์คํํ๊ธฐ ์ค์ตํธ] Internal Server Error - ํ์ธ์ด ๋ฆ์์ต๋๋ค^^; ===docker-compose.yml=== version: '3' services: my_flask: image: flask-redis ports: - 50027:5000 my_redis: image: redis ===app.py=== import time import redis from flask import Flask app = Flask(__name__) cache = redis.Redis(host='redis', port=6379) def get_hit_count(): retries = 5 while True: try: return cache.incr('hits') except redis.exceptions.ConnectionError as exc: if retries == 0: raise exc retries -= 1 time.sleep(0.5) @app.route('/') def hello(): count = get_hit_count() return 'Hello World! I have been seen {} times.\n'.format(count) ===Dockerfile=== FROM python:3.7-alpine WORKDIR /code ENV FLASK_APP app.py ENV FLASK_RUN_HOST 0.0.0.0 RUN apk add --no-cache gcc musl-dev linux-headers COPY requirements.txt requirements.txt RUN pip install -r requirements.txt COPY . . CMD ["flask", "run"] - 1
- 2
- 808
 




