I am writing script supporting my Django project development. First I thought of using bash for this purpose but due to lack of enough knowledge and total lack of time I decided to write something using argparse and running system commands using subprocess.
Everything went ok until I had to run
./manage.py migrate
I do it by running:
import subprocess
...
subprocess.Popen("python {} migrate".format(absolute_path_to_manage_py).split())
The output seems to look ok:
Operations to perform:
Apply all migrations: sessions, admin, auth, contenttypes, accounts, pcb
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
...
Applying sessions.0001_initial... OK
And it stops suddenly, but script is still active (it's still running) and what's worse when I run django app I get a message that I still have some unapplied migrations.
I think I don't know something about running system commands from Python or something related to django migrations.
Any hint how I could overcome this?