app.name shall be __main__ for console apps

This commit is contained in:
Armin Ronacher 2011-09-24 20:25:28 +02:00
parent 56afafae67
commit d2eefe25e7

View file

@ -466,7 +466,7 @@ class Flask(_PackageBoundObject):
if self.import_name == '__main__':
fn = getattr(sys.modules['__main__'], '__file__', None)
if fn is None:
return 'unknown'
return '__main__'
return os.path.splitext(os.path.basename(fn))[0]
return self.import_name