--- a/ProjectDjango/Project.py Wed Jan 01 11:58:57 2020 +0100 +++ b/ProjectDjango/Project.py Sun Feb 16 14:37:31 2020 +0100 @@ -1608,18 +1608,19 @@ args = ['--version'] ioEncoding = Preferences.getSystem("IOEncoding") cmd = self.__getDjangoAdminCommand() - if isWindowsPlatform(): - args.insert(0, cmd) - cmd = self.__getPythonExecutable() - - process = QProcess() - process.start(cmd, args) - procStarted = process.waitForStarted() - if procStarted: - finished = process.waitForFinished(30000) - if finished and process.exitCode() == 0: - output = str(process.readAllStandardOutput(), ioEncoding, - 'replace') + if cmd: + if isWindowsPlatform(): + args.insert(0, cmd) + cmd = self.__getPythonExecutable() + + process = QProcess() + process.start(cmd, args) + procStarted = process.waitForStarted() + if procStarted: + finished = process.waitForFinished(30000) + if finished and process.exitCode() == 0: + output = str(process.readAllStandardOutput(), ioEncoding, + 'replace') djangoVersion = output.splitlines()[0].strip() return djangoVersion @@ -1884,20 +1885,18 @@ shutil.rmtree(ppath, ignore_errors=True) args = [] - if Utilities.isWindowsPlatform(): - args.append(self.__getPythonExecutable()) - args.append(self.__getDjangoAdminCommand()) + cmd = self.__getDjangoAdminCommand() + if cmd: + if Utilities.isWindowsPlatform(): + args.append(self.__getPythonExecutable()) + args.append(cmd) else: - cmd = self.__getDjangoAdminCommand() - if cmd: - args.append(cmd) - else: - E5MessageBox.critical( - self.__ui, - title, - self.tr("""<p>The <b>django-admin.py</b> script is""" - """ not in the path. Aborting...</p>""")) - return False + E5MessageBox.critical( + self.__ui, + title, + self.tr("""<p>The <b>django-admin.py</b> script is""" + """ not in the path. Aborting...</p>""")) + return False args.append("startproject") args.append(projectName) @@ -1963,21 +1962,19 @@ args = [] if isGlobal: - if Utilities.isWindowsPlatform(): - args.append(self.__getPythonExecutable()) - args.append(self.__getDjangoAdminCommand()) + cmd = self.__getDjangoAdminCommand() + if cmd: + if Utilities.isWindowsPlatform(): + args.append(self.__getPythonExecutable()) + args.append(cmd) else: - cmd = self.__getDjangoAdminCommand() - if cmd: - args.append(cmd) - else: - E5MessageBox.critical( - self.__ui, - title, - self.tr("""<p>The <b>django-admin.py</b> script""" - """ is not in the path.""" - """ Aborting...</p>""")) - return + E5MessageBox.critical( + self.__ui, + title, + self.tr("""<p>The <b>django-admin.py</b> script""" + """ is not in the path.""" + """ Aborting...</p>""")) + return else: args.append(self.__getPythonExecutable()) args.append("manage.py")