I need use mysql database in the project of cookiecutter-django,but cookiecutter only support postgresql,what should i do?
You're right, cookiecutter-django only supports postgres.
However, at the end of day, the output is a Django project, so I suggest to refer to the documentation from Django itself, especially the DATABASES setting. You will need to swap out the settings we generate by the appropriate one for mysql.
If you use Docker, you will need to change the postgres service to use a MySQL Docker image.
I've never done it, but it should be feasible. Feel free to add more information here for others, but I do not think we plan to support MySQL in the cookiecutter-django (see #111).
@browniebroke is correct, Cookiecutter Django will not be supporting MySQL. That could change per my specification in #111.
Rather than changing out postgre for mysql, having you considered staying with postgre? Here are some considerations:
Here are my steps to use MySQL 5.7 on OS 10.13.6. My local mysql administrator account is root without password, so I can enter local mysql console by mysql -uroot and create the database:
follow cookiecutter-django instructions to start a project
https://github.com/pydanny/cookiecutter-django#usage
https://cookiecutter-django.readthedocs.io/en/latest/developing-locally.html
install MySQL 5.7, ensure mysql is in the path, start the MySQL service
brew install [email protected]
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
brew services start [email protected]
python -V
pip install mysqlclient django-environ
# "default": env.db("DATABASE_URL", default="postgres:///<your database name>")
"default": env.db("DATABASE_URL", default="mysql://root:@127.0.0.1:3306/<your database name>")
And it just works! Enjoy!
Most helpful comment
Here are my steps to use MySQL 5.7 on OS 10.13.6. My local mysql administrator account is
rootwithout password, so I can enter local mysql console bymysql -urootand create the database:follow cookiecutter-django instructions to start a project
https://github.com/pydanny/cookiecutter-django#usage
https://cookiecutter-django.readthedocs.io/en/latest/developing-locally.html
install MySQL 5.7, ensure
mysqlis in the path, start the MySQL serviceAnd it just works! Enjoy!