2022-03-17 16:33:36 +00:00
|
|
|
from flask import Flask
|
|
|
|
from redis import Redis
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
redis = Redis(host='redis', port=6379)
|
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
def hello():
|
|
|
|
redis.incr('hits')
|
|
|
|
counter = str(redis.get('hits'),'utf-8')
|
|
|
|
return "This webpage has been viewed "+counter+" time(s)"
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-07-08 14:48:08 +00:00
|
|
|
app.run(host="0.0.0.0", port=8000, debug=True)
|