ProjectDjango/Project.py

changeset 146
8c42fc23c94c
parent 145
104b14713e9e
child 148
4cb7aa43845d
equal deleted inserted replaced
145:104b14713e9e 146:8c42fc23c94c
1606 djangoVersion = "" 1606 djangoVersion = ""
1607 1607
1608 args = ['--version'] 1608 args = ['--version']
1609 ioEncoding = Preferences.getSystem("IOEncoding") 1609 ioEncoding = Preferences.getSystem("IOEncoding")
1610 cmd = self.__getDjangoAdminCommand() 1610 cmd = self.__getDjangoAdminCommand()
1611 if isWindowsPlatform(): 1611 if cmd:
1612 args.insert(0, cmd) 1612 if isWindowsPlatform():
1613 cmd = self.__getPythonExecutable() 1613 args.insert(0, cmd)
1614 1614 cmd = self.__getPythonExecutable()
1615 process = QProcess() 1615
1616 process.start(cmd, args) 1616 process = QProcess()
1617 procStarted = process.waitForStarted() 1617 process.start(cmd, args)
1618 if procStarted: 1618 procStarted = process.waitForStarted()
1619 finished = process.waitForFinished(30000) 1619 if procStarted:
1620 if finished and process.exitCode() == 0: 1620 finished = process.waitForFinished(30000)
1621 output = str(process.readAllStandardOutput(), ioEncoding, 1621 if finished and process.exitCode() == 0:
1622 'replace') 1622 output = str(process.readAllStandardOutput(), ioEncoding,
1623 'replace')
1623 djangoVersion = output.splitlines()[0].strip() 1624 djangoVersion = output.splitlines()[0].strip()
1624 1625
1625 return djangoVersion 1626 return djangoVersion
1626 1627
1627 def getDjangoVersion(self): 1628 def getDjangoVersion(self):
1882 return True 1883 return True
1883 1884
1884 shutil.rmtree(ppath, ignore_errors=True) 1885 shutil.rmtree(ppath, ignore_errors=True)
1885 1886
1886 args = [] 1887 args = []
1887 if Utilities.isWindowsPlatform(): 1888 cmd = self.__getDjangoAdminCommand()
1888 args.append(self.__getPythonExecutable()) 1889 if cmd:
1889 args.append(self.__getDjangoAdminCommand()) 1890 if Utilities.isWindowsPlatform():
1891 args.append(self.__getPythonExecutable())
1892 args.append(cmd)
1890 else: 1893 else:
1891 cmd = self.__getDjangoAdminCommand() 1894 E5MessageBox.critical(
1892 if cmd: 1895 self.__ui,
1893 args.append(cmd) 1896 title,
1894 else: 1897 self.tr("""<p>The <b>django-admin.py</b> script is"""
1895 E5MessageBox.critical( 1898 """ not in the path. Aborting...</p>"""))
1896 self.__ui, 1899 return False
1897 title,
1898 self.tr("""<p>The <b>django-admin.py</b> script is"""
1899 """ not in the path. Aborting...</p>"""))
1900 return False
1901 1900
1902 args.append("startproject") 1901 args.append("startproject")
1903 args.append(projectName) 1902 args.append(projectName)
1904 1903
1905 dia = DjangoDialog( 1904 dia = DjangoDialog(
1961 if os.path.exists(apath): 1960 if os.path.exists(apath):
1962 shutil.rmtree(apath, ignore_errors=True) 1961 shutil.rmtree(apath, ignore_errors=True)
1963 1962
1964 args = [] 1963 args = []
1965 if isGlobal: 1964 if isGlobal:
1966 if Utilities.isWindowsPlatform(): 1965 cmd = self.__getDjangoAdminCommand()
1967 args.append(self.__getPythonExecutable()) 1966 if cmd:
1968 args.append(self.__getDjangoAdminCommand()) 1967 if Utilities.isWindowsPlatform():
1968 args.append(self.__getPythonExecutable())
1969 args.append(cmd)
1969 else: 1970 else:
1970 cmd = self.__getDjangoAdminCommand() 1971 E5MessageBox.critical(
1971 if cmd: 1972 self.__ui,
1972 args.append(cmd) 1973 title,
1973 else: 1974 self.tr("""<p>The <b>django-admin.py</b> script"""
1974 E5MessageBox.critical( 1975 """ is not in the path."""
1975 self.__ui, 1976 """ Aborting...</p>"""))
1976 title, 1977 return
1977 self.tr("""<p>The <b>django-admin.py</b> script"""
1978 """ is not in the path."""
1979 """ Aborting...</p>"""))
1980 return
1981 else: 1978 else:
1982 args.append(self.__getPythonExecutable()) 1979 args.append(self.__getPythonExecutable())
1983 args.append("manage.py") 1980 args.append("manage.py")
1984 try: 1981 try:
1985 path = self.__sitePath() 1982 path = self.__sitePath()

eric ide

mercurial