I'm working on a multi tenant app using django-tenant-schema(and postgresql). Now as soon as the new schema is getting created, I'm using the call_command to create a superuser. I also thought of the option of using signal post_migrate.
My doubt is how can I auto create a superuser without typing the password in shell. The use case is as soon as the user registers for his/her schema, a superuser is generated and the user logs in with the superuser username and password and can change the password thereafter.
I'm using the following to call the createsuperuser command:
call_command('createsuperuser', schema_name=self.schema_name, username='admin', email='[email protected]')
One way to solve the issue is to change Django's createsuperuser.py
file and provide a password over there automatically, buts thats not an acceptable route, ie cahnging the source code for some use case. Could I please request for some better methods