【问题标题】:django -- __init__() keywords must be stringsdjango -- __init__() 关键字必须是字符串
【发布时间】:2013-08-22 21:18:43
【问题描述】:

我试图运行python manage.py runserver,但收到以下错误。你知道我该如何解决吗?

jalal@mona:/research/jalal/django/djcode/mysite$ python manage.py runserver

Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of   <django.contrib.staticfiles.management.commands.runserver.Command object at 0x13f8ed0>>
Traceback (most recent call last):
File "/home/jalal/.pythonbrew/pythons/Python-2.6/lib/python2.6/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run

__init__() keywords must be strings

如何解决这个问题?

谢谢。

【问题讨论】:

  • 您的模型似乎存在问题。你能给出你的models.py代码吗?
  • 你在运行 django 1.5 吗?
  • 你用的是什么版本的python?
  • 我正在使用 django 1.5 和 Python 2.6。我正在尝试像以前一样使用 pythonbrew 切换到 Python 2.7,但它说没有安装 python2.7。此外,当我使用 sudo apt-get install 安装 python2.7 并使用 which python 它显示 2.6 @MichaelVayvala
  • 这里是 mysite 文件夹中的 manage.py 代码但是我没有修改任何东西 paste.ofcode.org/37LERTC2csTGBNyCJM42iLk@Pixou

标签: python django web-developer-toolbar


【解决方案1】:

这是由未正确处理 unicode 参数的 known bug in Python 2.6 引起的。升级到 Python 2.7 即可解决此问题。

【讨论】:

  • 更具体地说,Django 1.5 所需的最低 Python 版本是 2.6.5。
【解决方案2】:

opensuse linux 下的 python 2.6.2 也有同样的问题。然后我在 Ubuntu 10.04 下尝试了 django 1.5.5 和 python 2.6.5。这解决了问题。

hansjh

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-01
    • 2022-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多