1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Django REST Framework APIの"api/"でAttributeError: 'OrderedDict' object has no attribute 'register'になった話

Last updated at Posted at 2019-10-08

はじめに

最近Djangoを仕事で使う必要ができたためせっかくだからとDjango REST FrameworkAPIを使おうと思いやり始めた出先でころんだ話。

症状

ここのサイトがわかりやすくて、進んでいたのですが、
http://localhost:3000/api/にアクセスした瞬間

500_error.png

AttributeError: 'OrderedDict' object has no attribute 'register'

となり画面がエラーになってしまいました。

結論

同じようなエラーのstackoverflowを発見したので、terminalでmarkdownのバージョンを確認しました。

Python 3.6.1 |Anaconda custom (x86_64)| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import markdown
>>> print('Markdown module path', markdown.__file__)
Markdown module path /Users/arata.honda/.pyenv/versions/anaconda3-4.4.0/lib/python3.6/site-packages/markdown/__init__.py
>>> print('Markdown version:', markdown.version)
Markdown version: 2.6.11
>>> ^C
KeyboardInterrupt
>>> exit()

と、2.6.11なんですね、ちょっとバージョン上げてみました。

arata.honda@hoge:demo_app$ pip install -U markdown
Collecting markdown
  Downloading https://files.pythonhosted.org/packages/c0/4e/fd492e91abdc2d2fcb70ef453064d980688762079397f779758e055f6575/Markdown-3.1.1-py2.py3-none-any.whl (87kB)
     |████████████████████████████████| 92kB 1.7MB/s
Requirement already satisfied, skipping upgrade: setuptools>=36 in /Users/arata.honda/.pyenv/versions/anaconda3-4.4.0/lib/python3.6/site-packages (from markdown) (39.0.1)
Installing collected packages: markdown
  Found existing installation: Markdown 2.6.11
    Uninstalling Markdown-2.6.11:
      Successfully uninstalled Markdown-2.6.11
Successfully installed markdown-3.1.1

もっかい叩くと動きましたとさ、というクソみたいな話。
補足:python manege.py migrateを一度でも叩いてない場合はdjango_sessionというテーブルを探しに行って絶対にエラーになって見れないです。

1
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?