#How to integrate existing MySQL database into a new django project?

11 messages · Page 1 of 1 (latest)

solar stone
#

I have a MySQL database previously used with a Laravel backend. I'm now transitioning to Django and have created a new Django project while keeping the database schema unchanged, with only a few naming improvements for clarity. However, I'm encountering an issue when connecting to the previous database. When running migrations, it creates new empty tables in the database instead of using the existing ones. I don't want to lose any existing data. I need help resolving this issue.

subtle cliff
#

see "inspectdb" and "legacy database" in official docs

solar stone
subtle cliff
#

What didn't work? Whole point of what I mentioned is that you have tables already

#

So it wouldn't work if you hadn't

raw sparrow
ivory igloo
#

You can migrate tables to model files usingpython manage.py incpectdbinstead of migrate .
Changing the table structure can modify the database by executing the above command.

gaunt coral
stoic tundra
#

Hi,
I am trying to link mysql database to my django project. I installed XAMPP and created a mysql database from that side. Whenever I do migrations, it just creates an sql lite db.
I am unable to attach the picture of the issue here. How do i resolve this error ?
Thank you for your assistance.

raw sparrow
#

You've already asked this elsewhere, please do not spam, thank you!

stoic tundra
#

Yes