django-tenant-schemas icon indicating copy to clipboard operation
django-tenant-schemas copied to clipboard

createsuperuser command is not working properly

Open MusharrafSakran opened this issue 5 years ago • 4 comments

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,

MusharrafSakran avatar Jan 16 '20 21:01 MusharrafSakran

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.

tai-mya avatar Jan 20 '20 23:01 tai-mya

Try downgrading to version 1.9.0. The version 1.10 has some problems with how commands are invoked, probably related to #613.

jeroenbrouwer avatar Jan 21 '20 18:01 jeroenbrouwer

python manage.py tenant_command createsuperuser --schema=schema_name

saileshkush95 avatar Feb 25 '20 07:02 saileshkush95

python manage.py tenant_command createsuperuser --schema=schema_name

In my case, this was the perfect solution for this issue.

faimaro avatar Apr 29 '20 12:04 faimaro