I am using django management command in my test like this
from django.core.management import call_command
call_command('loadusers')
Now I have the database on external server where i want to execute this command not on the database where the django currently is executing the tests.
How can i something like
call_command('loadusers', database="external")
settings.DATABASES[FIXTURE_DATABASE] = {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "external",
}
call_command("loadusers", database=FIXTURE_DATABASE, verbosity=0,
interactive=False)
I think it should work,found this here at Example 14 : http://www.programcreek.com/python/example/56194/django.core.management.call_command
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.