This is a good one for kind of anything you do via gcloud and want to do it within a script.
With any gcloud call, you can add the flag --log-http and it will spit out a bunch of useful stuff, including a uri tag which will be the REST API call that gcloud uses to fetch the information.
So in your case, you can run:
gcloud --log-http sql databases list --instance=mysqlinstance and the uri will come back with:
https://sqladmin.googleapis.com/sql/v1beta4/projects/<project-name>/instances/mysqlinstance/databases?alt=json
You can now use that REST call within the Python/Django script you have to fetch the same data. You'll need to handle credentials now of course because your script won't be authorized necessarily the same way gcloud will, unless you're always going to run the script from within your own environment. If you do, then it'll work fine as it will fetch your user credentials from within the same environment as you were running gcloud. But if you want this script to run elsewhere you'll need to manage credentials for it.
SELECT datnane FROM pg_database.