【问题标题】:Installed the pinax requirements over the base.txt file - nothing works?在 base.txt 文件上安装 pinax 要求 - 没有任何效果?
【发布时间】:2012-11-01 22:37:51
【问题描述】:

我在 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'

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

【问题讨论】:

  • 你运行的是哪个 Django 版本?这是 Django 1.4 中的新设置
  • 是的,我正在运行 django 1.4!

标签: python django pinax


【解决方案1】:

通常意味着——即使错误真的一点帮助都没有——在 Django 尝试导入您的设置文件时发生某种语法或导入错误。

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

  1. 在托管您的 manage.py 的目录中打开命令提示符(或 Powershell)。
  2. 查看DJANGO_SETTINGS_MODULE 中的manage.py 设置。可能是project.settings
  3. 在该控制台会话中打开一个 Python shell;然后import project.settings 或其他。很可能会出现异常。修复它:)

YMMV,希望对您有所帮助...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-18
    • 2010-11-17
    • 2016-04-30
    • 2016-06-28
    • 1970-01-01
    • 2017-01-30
    • 1970-01-01
    • 2016-09-02
    相关资源
    最近更新 更多