2

I am new to Django, and I was given a complete MySQL database with all relations and tables set. I am trying to put this data from MySQL database into my admin site.

I want to know if there is any other way to retrieve data from MySQL database without using Django models.

MySQL Database MySQL database

I tried to use autogenerated model, but it did not work for me. Data doesn't show up in the admin site. (P.S. I do not necessarily require data to be in admin site, I am just trying to use it any ways possible)

Auto-generated model by django

python manage.py inspectdb > models.py

admin.py

from django.contrib import admin

# Register your models here.
from .models import Ligand

admin.site.register(Ligand)

Please, let me know if you know any ways to use data from MySQL database that was not created using Django model.

Thanks in advance

1 Answer 1

1

python manage.py inspectdb can be run to detect and generate models. More on it here: https://docs.djangoproject.com/en/2.2/howto/legacy-databases/

Sign up to request clarification or add additional context in comments.

2 Comments

I couldn't find the way to post this into admin site or either use the data using database API.
For using the admin tools, you will need to register the models created in your admin.py file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.