django-tenant-schemas
django-tenant-schemas copied to clipboard
createsuperuser command is not working properly
I'm using the below versions:
python=3.7
django==2.2
django-tenant-schemas=1.10.0
When I try to apply this command as mentioned in the latest documentaion here:
./manage.py createsuperuser --username=admin --schema=customer1
the below error is shown:
usage: manage.py createsuperuser [-h] [--username USERNAME] [--noinput]
[--database DATABASE] [--email EMAIL]
[--version] [-v {0,1,2,3}]
[--settings SETTINGS]
[--pythonpath PYTHONPATH] [--traceback]
[--no-color] [--force-color]
manage.py createsuperuser: error: unrecognized arguments: --schema=customer1
And the only way to run this command with my case is to write it as below:
./manage.py tenant_command createsuperuser --schema=customer1
or
./manage.py tenant_command -s=customer1 createsuperuser
And the prompt will ask for the username, email and password afterwards.
I beleive that we either have to update the documentation or fix the issue that is caused if the command in the documentation is right.
Thanks,
There is a similar symptom of this issue with this command from Django 2.2.9 also:
bash-4.2# python manage.py tenant_command loaddata data.json
usage: manage.py tenant_command [-h] [-s SCHEMA_NAME] [--version]
[-v {0,1,2,3}] [--settings SETTINGS]
[--pythonpath PYTHONPATH] [--traceback]
[--no-color] [--force-color]
command
manage.py tenant_command: error: unrecognized arguments: data.json
Other permutations of the same command gives similar results:
python manage.py tenant_command loaddata -s SCHEMA_NAME data.json
python manage.py tenant_command loaddata --schema=SCHEMA_NAME data.json
python manage.py tenant_command -s SCHEMA_NAME loaddata data.json
Only workaround I found is to invoke call_command with the fixtures file argument directly from Django shell.
Try downgrading to version 1.9.0. The version 1.10 has some problems with how commands are invoked, probably related to #613.
python manage.py tenant_command createsuperuser --schema=schema_name
python manage.py tenant_command createsuperuser --schema=schema_name
In my case, this was the perfect solution for this issue.