0

启动 Django 服务器时出现异常。我python manage.py runserver 0.0.0.0:80用来启动服务器。

我得到了这个例外:ValueError: Invalid default_markup_type for field 'None', allowed values: html, plain

这是堆栈跟踪:

Validating models...

Failed to setup thread-interrupt handler. This is usually not critical
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x2274c90>>
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 91, in inner_run
    self.validate(display_num_errors=True)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate
    num_errors = get_validation_errors(s, app)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 30, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 158, in get_app_errors
    self._populate()
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 64, in _populate
    self.load_app(app_name, True)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 88, in load_app
    models = import_module('.models', app_name)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/kcastillo/NMCSVs/nmcsv/models.py", line 29, in <module>
    class Description(UserData):
  File "/home/kcastillo/NMCSVs/nmcsv/models.py", line 30, in Description
    text = MarkupField("Description", default_markup_type='markdown')
  File "/usr/local/lib/python2.7/dist-packages/markupfield/fields.py", line 106, in __init__
    (name, ', '.join(self.markup_choices_list)))
ValueError: Invalid default_markup_type for field 'None', allowed values: html, plain

例外是这行代码:

text = MarkupField("Description", default_markup_type='markdown')

这些都在工作。从我们的 svn 中检查出来后,我无法让它在我的虚拟机上运行。

谢谢。

4

1 回答 1

0

显然,我错过了markdownDjango 的模块。由于Django一开始并没有抱怨我没有这个模块,所以我对错误感到困惑。

解决方案是安装模块。

pip install markdown

于 2013-02-10T00:45:09.680 回答