python django 1.7.6用模板启动一个新项目:zipfile.BadZipfile:文件不是zip文件

时间:2015-03-18 14:53:50

标签: python django

我在新的virtualenv下安装了django-1.7.6,而python的版本是2.7.6。

当我使用模板:edge2启动一个新项目时,我遇到了一个错误:zipfile.BadZipfile:File不是zip文件。

使用命令:

django-admin.py startproject --template=https://github.com/arocks/edge/archive/master.zip --extension=py,md,html,env example

以下是控制台输出的全部详细信息:

django-admin.py startproject --template=https://github.com/arocks/edge/archive/master.zip --extension=py,md,html,env example Traceback (most recent call last): File "/usr/local/bin/django-admin.py", line 5, in <module> management.execute_from_command_line() File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 377, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 338, in execute output = self.handle(*args, **options) File "/Library/Python/2.7/site-packages/django/core/management/commands/startproject.py", line 31, in handle super(Command, self).handle('project', project_name, target, **options) File "/Library/Python/2.7/site-packages/django/core/management/templates.py", line 122, in handle base_subdir) File "/Library/Python/2.7/site-packages/django/core/management/templates.py", line 205, in handle_template return self.extract(absolute_path) File "/Library/Python/2.7/site-packages/django/core/management/templates.py", line 299, in extract archive.extract(filename, tempdir) File "/Library/Python/2.7/site-packages/django/utils/archive.py", line 49, in extract with Archive(path) as archive: File "/Library/Python/2.7/site-packages/django/utils/archive.py", line 58, in __init__ self._archive = self._archive_cls(file)(file) File "/Library/Python/2.7/site-packages/django/utils/archive.py", line 181, in __init__ self._archive = zipfile.ZipFile(file) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 766, in __init__ self._RealGetContents() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 807, in _RealGetContents raise BadZipfile, "File is not a zip file" zipfile.BadZipfile: File is not a zip file

实际上,当我使用模板启动一个新的django项目时,我遇到了类似上面的错误。

1 个答案:

答案 0 :(得分:0)

我已经尝试过你的命令,它对我有用。

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 807

引发IOError。这可能有多种原因,例如磁盘空间不足。