Closed adkulas closed 5 years ago
I wonder if having to install default-libmysqlclient-dev and mysqlclient is the only way to connect to mysql. There are django apps out there that having been deployed with MySQL databases. I'm going to look for potential pyramid with MySQL database examples deployed to Heroku to see if there's a workaround. I don't want to go down the docker route just yet. I had a lot of issues with it previously and I'd rather see if there's a simple fix to this before I take on that beast again.
Ok so there may be a workaround. There is an alternative way to connect to the database using mysqlclient. The alternative option is mysql-connector-python. There doesn't seem to be a linux dependency needed for it so we we might be in the clear with using the dyno.
The django apps that work use the djagno ORM so sqlalchemy isnt involved. @jmcarrillog prefers django because hes finding more resources on the framework. Should we consider switching?
There's a heck of a lot more documentation for django deployments on Heroku as well. I'm all for switching to it.
@adkulas I am actually using "mysql-connector-python" instead of "mysqlclient".
bad news... django also requires the same mysql driver
File "/home/calkulas/Documents/ECE651/ece651-group-project/healthapp_project/env/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 20, in <module>
) from err
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
[2019-02-27 22:18:26 +0000] [19969] [INFO] Worker exiting (pid: 19969)
[2019-02-27 17:18:26 -0500] [19966] [INFO] Shutting down: Master
[2019-02-27 17:18:26 -0500] [19966] [INFO] Reason: Worker failed to boot.
I'm really not interested in trying to find workarounds for this since it's taking a lot of time. What does everyone think of switching to postgres to avoid these problems?
@ammarahmed93 is this something doable for you in a very short amount of time? Do you have to backtrack a lot to make this work?
@gaberch I don't think it would be doable with the time we got. I have never worked with Django ORM so it will be a learning curve and I am assuming it would require a lot of time reading, troubleshooting, and if not writing a whole new code from scratch.
@gaberch @ammarahmed93 im currently looking into docker to bypass the dependency problem
@adkulas I would suggest looking into the documentation for the ClearDB add-on for Heroku. There's documentation on it for how to use it with a Django app. Maybe they have something there to bypass this problem since ClearDB is meant for MySQL and they say it works with Django. https://devcenter.heroku.com/articles/cleardb#using-cleardb-with-python-django
I don't think we need to use Docker to solve this issue.
Looked into the difference between mysqlclient and mysql-connector-python and found these
https://stackoverflow.com/questions/26573984/django-how-to-install-mysql-connector-python-with-pip3 https://dev.mysql.com/doc/connector-python/en/connector-python-django-backend.html
The mysql-connector-python is written in pure python. Going to try that and see if it connects
In order to run sqlalchemy with mysql you need to install the python package
pip install mysqlclient
. This package requires a linux dependency installed usingsudo apt install default-libmysqlclient-dev
.The problem is dynos do not allow the installation of additional linux packages. I believe the solution will be to create a docker image and deploy the image on heroku. Or we must look for another deployment method.