V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
xiayibu
V2EX  ›  Python

django 这个错误如何解决,网上找不到解决办法

  •  
  •   xiayibu · 2017-07-03 20:11:17 +08:00 · 3271 次点击
    这是一个创建于 2494 天前的主题,其中的信息可能已经有所发展或是发生改变。

    django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'title' used in key specification without a key length")

    5 条回复    2017-07-03 21:13:43 +08:00
    goophy
        1
    goophy  
       2017-07-03 20:18:29 +08:00 via iPhone
    字面意思清楚了吧,title 用作 key,但没定义长度
    xiayibu
        2
    xiayibu  
    OP
       2017-07-03 20:20:55 +08:00
    @goophy 定义了,我把 title 整段代码注释掉也报这个错误
    zhmin
        3
    zhmin  
       2017-07-03 20:23:25 +08:00 via iPhone
    @xiayibu pyc 文件删除了吗?
    xiayibu
        4
    xiayibu  
    OP
       2017-07-03 20:26:54 +08:00
    @zhmin 删除了,也报错,admin 后台能正常添加数据,但是代码这块就报这个错
    xiayibu
        5
    xiayibu  
    OP
       2017-07-03 21:13:43 +08:00
    解决了,我把 migrations 文件夹下的所有文件都删除就好了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2256 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 08:25 · PVG 16:25 · LAX 01:25 · JFK 04:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.