Tethik / flask-session-captcha

A captcha implemention for flask
MIT License
24 stars 8 forks source link

Specified key was too long; max key length is 767 bytes #2

Closed wenguonideshou closed 6 years ago

wenguonideshou commented 7 years ago

sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1071, u'Specified key was too long; max key length is 767 bytes') [SQL: u'\nCREATE TABLE sessions (\n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tsession_id VARCHAR(255), \n\tdata TEXT, \n\texpiry DATETIME, \n\tPRIMARY KEY (id), \n\tUNIQUE (session_id)\n)\n\n']

mariadb5.5 with INNODB engine, character utf8mb4 When I run python manage.py runserver -h 0.0.0.0 -p 5000

Tethik commented 6 years ago

Somehow I missed this issue, sorry about that. I'll take a look over the weekend.

Although I'm guessing this has something to do with the underlying sessions package.

Tethik commented 6 years ago

I tested it using a Mariadb docker-container and the sample from the readme. Probably the issue you had is with the underlying session provider since that is what will crate the table for you. I recommend using flask-sessionstore

Tethik commented 6 years ago

I committed my sample into the repo here: https://github.com/Tethik/flask-session-captcha/tree/master/sample/mariadb