I have created a project using Golang. I have used PostgreSQL as the database. Now I want to make an admin panel for this project using Django. I want directly reflect the database tables in the Django admin panel. As I am not running the project under the Django server and I don’t have any apps and models, how can I show them in the admin panel?
Question posted in PostgreSQL
The official documentation can be found here.
The official documentation can be found here.
2
Answers
First create an empty project in django then in settings.py set your database as postgreSQL
}
make sure to create superuser for login in admin panel and proper urls for the same.
Add models in models.py and register it in admin.py
P.S – make sure you have installed psycopg2 using pip command.
What you want is to use an existing DB to be managed by the DJango admin. To do this you must create a django project and create the models for each table. This is very tedious so there is an official process so you don’t have to do all this work and it is done automatically.
https://docs.djangoproject.com/en/4.1/howto/legacy-databases/