sul-cidr / scriptchart-backend

Admin UI and API for Scriptchart
https://db.syriac.reclaim.hosting/admin
MIT License
1 stars 0 forks source link

Sort out Django/mysql client weirdness on backend #29

Closed broadwell closed 5 years ago

broadwell commented 5 years ago

The backend installation instructions in the README file currently don't work "out of the box" for most install environments due to some issues with the Python MySQL client library used by Django to talk to the DB. Some rather hacky workarounds are necessary at present; to improve the stability of the backend, we should find a better solution.

More information: depending on their OS and environment, users tend to encounter a version error when trying to run any manage.py commands that involve communication between Django and the MySQL server: django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3. The error is actually related to the PyMySQL module, which is loaded at the top of scriptchart/settings.py via some code that loads the PyMySQL library and tells it to impersonate the mysqlclient library, as suggested in this SO post: https://stackoverflow.com/questions/7224807/what-is-pymysql-and-how-does-it-differ-from-mysqldb-can-it-affect-django-deploy

Direct modification of the PyMySQL Python libraries is often needed to get around this error, see https://github.com/PyMySQL/PyMySQL/issues/610

We'd prefer a different solution, such as using mysqlclient library directly, but need to investigate first.

simonwiles commented 5 years ago

Fixed by commit de2407b (here). Installing mysqlclient is not going to be possible in the shared hosting environment, so this is the cleanest available solution.