I’m trying to build a webapp with flask. I installed flask, created a webapp in 
IDLE, but when I tried testing it at my terminal, I got a huge error message. 
This is the app:

from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello() -> str:
    return 'Hello world from Flask!'
app.run()

This is my command and the resulting error message, containing a warning in red:

Last login: Thu Jun 14 23:54:55 on ttys000
192:~ TamaraB$ cd Desktop/Webapp/
192:Webapp TamaraB$ python3 hello_flask.py
 * Serving Flask app "hello_flask" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
Traceback (most recent call last):
  File "hello_flask.py", line 6, in <module>
    app.run()
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py",
line 943, in run
    run_simple(host, port, self, **options)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/werkzeug/serving.py",
line 814, in run_simple
    inner()
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/werkzeug/serving.py",
line 774, in inner
    fd=fd)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/werkzeug/serving.py",
line 660, in make_server
    passthrough_errors, ssl_context, fd=fd)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/werkzeug/serving.py",
line 577, in __init__
    self.address_family), handler)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py",
line 453, in __init__
    self.server_bind()
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/server.py",
line 136, in server_bind
    socketserver.TCPServer.server_bind(self)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py",
line 467, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 48] Address already in use
192:Webapp TamaraB$

What went wrong?
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to