although you have found the problem yourself, I would like to say that do not use Pycharm to start flask projects.
I encountered this similar problem because when I used flask-socketio to write websocket applications, I found that pycharm could not start the project normally
. So if you are writing applications with flask, it is best to use terminal startup projects
this is a problem with PyCharm configuration. As Atey encountered, all you need to do is delete the configuration file of type Flask identified and created by PyCharm and change it to a configuration file of type Python.
the entry for modifying the configuration file is generally located in the upper right corner of the window. In the drop-down window, click Edit Configurations, to enter editing.
give it a try.
visit 192.168.0.101 VOL5000
under your own ping.
I'm running locally now
192.168.0.102-- [08/Aug/2018 11:25:01] "GET / HTTP/1.1" 200-
192.168.0.102-[08/Aug/2018 11:25:01] "GET / favicon.ico HTTP/1.1" 404-
correct understanding is that the core is to change the host to (0.0.0.0), which can be accessed by the public network. But I found that no . If by extranet you mean other machines on the Internet, you may need to know about ISP and intranet penetration .
but what @ f2st says can be tested locally, in fact, there is no problem with the external network. The machine you use to access the server and your server need to be in the same local area network .
1, answer for the first time
< hr >
restart the machine to make sure you have shut down the original flask process.
2. Answer for the second time after the subject posted the startup information
< hr >
from the startup information, Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
)
you must use http://127.0.0.1:5000/ to access the page.
I ask weakly, subject, are you sure your script name is app.py?
maybe my question misled you. It should be a project configuration issue, not a code issue. There is nothing wrong with the above code.
although I have solved this problem, I have used a very stupid approach. @ Li Yi helped me remotely and decided that the problem was that the local app file was not executed. I searched a lot of places and found that the running environment needed to be configured. However, I didn't find out how to configure it.
so create a new folder, create a flask project without using pychram, and manually create a virtual environment.
1, pip install virtualenv
2, python-m virtualenv env
then create the flask project with pychram, and configure configuration, as follows
can run the local app.py
Thank @ Li Yi for his help and look forward to the answers from other great gods.
Resources:
https://blog.csdn.net/qq_3348.