ignore colon with slash when split app_import_path
Flask currently supports importing app through a combination of module path and app variable name, such as '/usr/app.py:my_app'. When the module path contains a colon, it will conflict with this import way and a `flask.cli.NoAppException` will be raised. A file path on a Windows system may contain a colon followed by a slash. So we solved this problem on Windows by ignoring the colon followed by a slash when we split app_import_path. Fix issue #2961.
This commit is contained in:
parent
363205bdc3
commit
c38499bbf2
2 changed files with 17 additions and 4 deletions
|
|
@ -369,7 +369,7 @@ class ScriptInfo(object):
|
|||
app = call_factory(self, self.create_app)
|
||||
else:
|
||||
if self.app_import_path:
|
||||
path, name = (self.app_import_path.split(':', 1) + [None])[:2]
|
||||
path, name = (re.split(r':(?![\\/])', self.app_import_path, 1) + [None])[:2]
|
||||
import_name = prepare_import(path)
|
||||
app = locate_app(self, import_name, name)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue