Hi all,
I’m a beginner in programming as well as docker. I was following the Docker Compose tutorial here: Try Docker Compose | Docker Docs. I followed every step and can’t seem to start the application with docker-compose up
I got this error:
web_1 | Traceback (most recent call last):
web_1 | File “app.py”, line 7, in
web_1 | app = Flask(test)
web_1 | NameError: name “test” is not defined
I created app.py just like in the tutorial:
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)
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
Since I keep getting the Name error so I can’t access the local host. Can someone help me with this?
Thank you
`