make sure that the commands are operating in the right database
This commit is contained in:
parent
b314bcae5d
commit
c54dcd07d9
1 changed files with 7 additions and 1 deletions
|
@ -3,7 +3,7 @@ import tempfile
|
|||
|
||||
from django.core.management import call_command
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import connections
|
||||
from django.db import connections, router
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
@ -22,6 +22,12 @@ class Command(BaseCommand):
|
|||
'NAME': tmp,
|
||||
}
|
||||
|
||||
# This is not nice, but the easiest way
|
||||
def tmpdb(*args, **kwargs):
|
||||
return 'tmpdb'
|
||||
router.db_for_read = tmpdb
|
||||
router.db_for_write = tmpdb
|
||||
|
||||
try:
|
||||
call_command('migrate', database='tmpdb')
|
||||
call_command('loadmap', yes=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue