Weird problems in the current path of Falsk

problem description

I"ll write a random project to test
F:/gggggg/index.py

The

code is simple enough to output the current work path

from flask import Flask
app = Flask (_ _ name__)
import os
@ app.route ("/")
def xxxx ():

print(os.path.abspath("."))
return "Hello World!"

if name ="_ _ main__":

app.run(port=8000, debug=True)

visit
http://127.0.0.1:8000/

after startup

the output from the console is D:/PyCharm 5.0.3/jre/jre/bin

then I changed index.py to 11.py. execute
again, but this time the console output is F:/gggggg !?

how to explain this phenomenon?

Jun.24,2021

the reason why the python installation path appears for the first time is that there will be an index.py file in the installation path

   

Menu