[IMP] cli: extract the project's path from active virtualenv (closes: #16512)

The start command takes the default dbname from the path.
But when running inside a virtualenv, it is a better default to take the
dbname from the virtualenv's path.
This commit is contained in:
Daniel Reis
2017-04-21 10:32:09 +02:00
committed by Fabien Meghazi
parent 852940f1ba
commit 3e0b720e51
+3
View File
@@ -35,6 +35,9 @@ class Start(Command):
args, unknown = parser.parse_known_args(args=cmdargs)
# When in a virtualenv, by default use it's path rather than the cwd
if args.path == '.' and os.environ.get('VIRTUAL_ENV'):
args.path = os.environ.get('VIRTUAL_ENV')
project_path = os.path.abspath(os.path.expanduser(os.path.expandvars(args.path)))
module_root = get_module_root(project_path)
db_name = None