1

我是 Python 新手,但我已经到处寻找这个问题的答案。不过好像每个人都不一样。我在 osx Mavericks,使用 Python 3.4 和 Django 1.7。

当我运行 python3 manage.py runserver 时,我没有得到任何服务器详细信息,而是得到

TypeError: 'NoneType' object is not callable

这是我的回溯:

Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", line 416, in execute_from_command_line
Validating models...

utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", line 408, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/base.py", line 244, in run_from_argv
0 errors found
self.execute(*args, **options.__dict__)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/base.py", line 291, in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 76, in handle
self.run(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 85, in run
autoreload.main(self.inner_run, args, options)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/utils/autoreload.py", line 359, in main
reloader(wrapped_main_func, args, kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/utils/autoreload.py", line 325, in python_reloader
reloader_thread()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/utils/autoreload.py", line 304, in reloader_thread
if fn():
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/utils/autoreload.py", line 173, in kqueue_code_changed
watcher = tempfile.TemporaryFile(bufsize=0)
TypeError: TemporaryFile() got an unexpected keyword argument 'bufsize'
Exception ignored in: <bound method Signal._remove_receiver of  <django.dispatch.dispatcher.Signal object at 0x1022d1588>>
Traceback (most recent call last):
 File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site packages/django/dispatch/dispatcher.py", line 276, in _remove_receiver
 TypeError: 'NoneType' object is not callable

有什么想法吗?

4

1 回答 1

0

如果您不熟悉 Python 和 Django,请使用最新版本而不是开发版本。在撰写本文时,最新版本是 Django 1.6 和 Python 2.7 或 3.3。

我建议现在将 Python 2.7 与 Django 一起使用,因为您找到的大多数教程和博客文章都是针对 Python 2.X 的。

于 2013-11-06T17:27:51.480 回答