I've been using social_django for OAuth in my Outreachy Round-15 project [[ https://tools.wmflabs.org/outreachy-wikicv/wiki-cv/ | WikiCV ]] , and in [[ https://github.com/MeghaSharma21/WorklistTool-GSoC-2018 | GSoC project ]] as well, as explained in [[ https://wikitech.wikimedia.org/wiki/Help:Toolforge/My_first_Django_OAuth_tool | My first Django OAuth Tool. ]] Things were fine as long as I was using SQLite. But then I decided to move from SQLite to MySQL. If you're planning to do the same, it's not going to be easy. Why? Here's the answer.
Firstly during installation you'll be able to install mysqlclient but since libmysqlclient-dev is not installed in Toolforge when using Kubernetes, it won't work. For workaround for that refer to - [[ https://phabricator.wikimedia.org/T190274 | this phabricator ticket ]] and [[ https://stackoverflow.com/a/14076841 | stackoverflow link ]].
Secondly, while migrating if you come across an error like this:
`django.db.utils.InternalError: (1709, 'Index column size too large. The maximum column size is 767 bytes.')`
Then this is because Toolforge is using 10.0.2 (**check, check!**) version of MySQL in which limitations are imposed on index columns. I encountered this error because I was using social_django app which had index columns with length > 767 bytes.
Solution for the this is:
1. Go through [[ http://python-social-auth-docs.readthedocs.io/en/latest/configuration/settings.html#tweaking-some-fields-length | this ]] documentation which says that you need to tweak the lengths of some columns in order to make it work with databases like MySQL InnoDB. Set all the 4 variables mentioned here to `767/<<LENGTH_OF_DATA_TYPE_OF_INDEXED_COLUMN>>` in the settings of your project (in settings.py file).
2. Your .cnf file should look something like [[ https://github.com/MeghaSharma21/WorklistTool-GSoC-2018/blob/dev/database.cnf | this file ]]
3. In my case (as I had done migrations earlier also, with sqlite) changes done to the lengths of index columns in social_django weren't getting reflected even on re-migrating. So I had to delete the migrations folder in social_django and then migrate.
All of this took a lot of google-searching and help from my mentor.
I feel that if it was there in the documentation, it could have saved a lot of effort. I'm penning this down so that someone else's efforts could be saved.
Hope it would help.