0
c:\DemoBlog\blog_system>manage.py syncdb
Traceback (most recent call last):
File "C:\DemoBlog\blog_system\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
 File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
399, in execute_from_command_line
utility.execute()
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 242,
 in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 280,
 in execute
translation.activate('en-us')
File "C:\Python34\lib\site-packages\django\utils\translation\__init__.py", lin
e 130, in activate
return _trans.activate(language)
File "C:\Python34\lib\site-packages\django\utils\translation\trans_real.py", l
ine 188, in activate
 _active.value = translation(language)
 File "C:\Python34\lib\site-packages\django\utils\translation\trans_real.py", l
ine 177, in translation
  default_translation = _fetch(settings.LANGUAGE_CODE)
  File "C:\Python34\lib\site-packages\django\utils\translation\trans_real.py", l
ine 159, in _fetch
    app = import_module(appname)
  File "C:\Python34\lib\importlib\__init__.py", line 104, in import_module
  return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2189, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1448, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "C:\Python34\lib\site-packages\file_picker\__init__.py", line 4, in <modu
le>
from file_picker.views import FilePickerBase, ImagePickerBase
File "C:\Python34\lib\site-packages\file_picker\views.py", line 73
except Exception, e:
^
SyntaxError: invalid syntax

我不知道有什么问题。但是当我清理我的 settings.py

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'file_picker',
'file_picker.uploads',
'file_picker.wymeditor',
'bootstrap_toolkit',
'blog',

)

并关闭与文件选择器和引导程序相关的所有内容 - 它可以工作,请帮助我...................... ..................................................... ..................................................... .....................................................

我修复了它except Exception as e 比我再试一次 - 它显示

c:\DemoBlog\blog_system>manage.py syncdb
C:\Python34\lib\importlib\_bootstrap.py:321: DeprecationWarning: django.utils.si
mplejson is deprecated; use json instead.
  return f(*args, **kwds)
Traceback (most recent call last):
File "C:\DemoBlog\blog_system\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
399, in execute_from_command_line
utility.execute()
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 242,
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 280,
in execute
 translation.activate('en-us')
File "C:\Python34\lib\site-packages\django\utils\translation\__init__.py", lin
e 130, in activate
return _trans.activate(language)
File "C:\Python34\lib\site-packages\django\utils\translation\trans_real.py", l
ine 188, in activate
_active.value = translation(language)
File "C:\Python34\lib\site-packages\django\utils\translation\trans_real.py", l
ine 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\Python34\lib\site-packages\django\utils\translation\trans_real.py", l
ine 159, in _fetch
app = import_module(appname)
File "C:\Python34\lib\importlib\__init__.py", line 104, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2189, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1448, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "C:\Python34\lib\site-packages\file_picker\__init__.py", line 4, in <modu
le>
from file_picker.views import FilePickerBase, ImagePickerBase
File "C:\Python34\lib\site-packages\file_picker\views.py", line 17, in <module>
from sorl.thumbnail.main import DjangoThumbnail
File "C:\Python34\lib\site-packages\sorl\thumbnail\main.py", line 4, in <module>
from django.utils.encoding import iri_to_uri, force_unicode
ImportError: cannot import name 'force_unicode'

..................................................... ..................................................... ..................................................... ................................ 在安装 sorl-thumnail 之前,我必须安装一些要求,如 redis、Pillow、pgmagick和魔杖。

只有我无法安装 pgmagick - 这是错误

C:\Users\www>pip install pgmagick
Downloading/unpacking pgmagick
Downloading pgmagick-0.5.7.tar.gz
Running setup.py (path:C:\TEMP\pip_build_www\pgmagick\setup.py) egg_info for p
ackage pgmagick
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "C:\TEMP\pip_build_www\pgmagick\setup.py", line 74, in <module>
raise Exception("Magick++ not found")
Exception: Magick++ not found
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "C:\TEMP\pip_build_www\pgmagick\setup.py", line 74, in <module>
raise Exception("Magick++ not found")
Exception: Magick++ not found
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in C:\TEMP\pip_build_w
ww\pgmagick
Storing debug log for failure in C:\Users\www\pip\pip.log

..................................................... ..................................................... .......比我安装了sorl-thumbnail,什么也没发生,然后再试一次-

c:\site>manage.py syncdb
C:\Python34\lib\importlib\_bootstrap.py:321: DeprecationWarning: django.utils.si
mplejson is deprecated; use json instead.
return json

Traceback (most recent call last):
File "C:\site\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
399, in execute_from_command_line
utility.execute()
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 242,
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 280,
in execute
translation.activate('en-us')
File "C:\Python34\lib\site-packages\django\utils\translation\__init__.py", lin
e 130, in activate
return _trans.activate(language)
File "C:\Python34\lib\site-packages\django\utils\translation\trans_real.py", l
ine 188, in activate
_active.value = translation(language)
File "C:\Python34\lib\site-packages\django\utils\translation\trans_real.py", l
ine 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\Python34\lib\site-packages\django\utils\translation\trans_real.py", l
ine 159, in _fetch
app = import_module(appname)
File "C:\Python34\lib\importlib\__init__.py", line 104, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2189, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1448, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "C:\Python34\lib\site-packages\file_picker\__init__.py", line 4, in <modu
le>
from file_picker.views import FilePickerBase, ImagePickerBase
File "C:\Python34\lib\site-packages\file_picker\views.py", line 17, in <module>
from sorl.thumbnail.main import DjangoThumbnail
ImportError: No module named 'sorl.thumbnail.main'
4

2 回答 2

0

看起来语法错误位于“C:\Python34\lib\site-packages\file_picker\views.py”,第 73 行

存在与 except 语句相关的语法错误。

于 2014-05-14T20:50:38.423 回答
0

您使用旧版本的 sorl-thumbnail - 它不能与您的 django 版本一起使用。您需要升级 sorl-thumbnail。不能说更具体,因为不知道您使用的是什么版本的 sorl-thumbnail 和 django。

于 2014-05-15T00:14:16.303 回答