0

我在 base.txt 文件上安装了 pinax 要求。

现在当我做 python manage.py syncdb 我得到:

Traceback (most recent call last):
  File "manage.py", line 20, in <module>
    execute_from_command_line()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
443, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
69, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in im
port_module
    __import__(name)
  File "C:\Python27\lib\site-packages\django\core\management\commands\syncdb.py"
, line 8, in <module>
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_
signal
  File "C:\Python27\lib\site-packages\django\core\management\sql.py", line 6, in
 <module>
    from django.db import models
  File "C:\Python27\lib\site-packages\django\db\__init__.py", line 40, in <modul
e>
    backend = load_backend(connection.settings_dict['ENGINE'])
  File "C:\Python27\lib\site-packages\django\db\__init__.py", line 34, in __geta
ttr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "C:\Python27\lib\site-packages\django\db\utils.py", line 90, in __getitem
__
    self.ensure_defaults(alias)
  File "C:\Python27\lib\site-packages\django\db\utils.py", line 80, in ensure_de
faults
    conn.setdefault('TIME_ZONE', 'UTC' if settings.USE_TZ else settings.TIME_ZON
E)
  File "C:\Python27\lib\site-packages\django\utils\functional.py", line 185, in
inner
    return func(self._wrapped, *args)
AttributeError: 'Settings' object has no attribute 'USE_TZ'

我真的不知道如何解决这个问题。因此,我为我得到的每一个想法/建议感到高兴!

4

1 回答 1

0

通常意味着——即使该错误根本没有帮助——当 Django 尝试导入您的设置文件时,会发生某种语法或导入错误。

尝试打开一个 shell 并手动导入设置模块,看看你得到了什么异常(如果有的话):

  1. 在托管您的manage.py.
  2. 看看里面的DJANGO_SETTINGS_MODULE设置manage.py。可能是project.settings
  3. 在该控制台会话中打开一个 Python shell;然后import project.settings或其他。很可能会出现异常。修理它 :)

YMMV,希望这有帮助......

于 2012-11-01T22:43:39.860 回答