Flask failure

Colin McPhail colin.mcphail at mac.com
Fri Jun 15 13:05:06 EDT 2018



> On 15 Jun 2018, at 16:19, T Berger <brgrt2 at gmail.com> wrote:
> 
> 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()
> 
[snip]

>  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?

Did the instructions for running this Flask example mention anything about not using the standard HTTP port number (80)?  I don’t know much about Flask but I expect it runs an HTTP server in order to serve your HTML content to clients. If it tries to use the standard port then it will likely find it is already in use or that you do not have permission to use it.

— Colin




More information about the Python-list mailing list