Reputation: 5507
I need to call Popen
command from my Django app
it works on development machine but it is not executing when I try to call that command when application is served by Apache
no error either it just finishes silently.
def backup():
filename = datetime.datetime.now().strftime("%d-%b-%Y_%I-%M-%S-%p")
Popen(
'pg_dump --dbname=postgresql://postgres:[email protected]:5432/db -f D:/backup/%s' % filename,
shell=True
)
Can someone please tell me what is wrong .
Upvotes: 2
Views: 524
Reputation: 5507
This post helped me.
I have to modify the call to Popen a bit now I'm invoking psql by full path
Popen(
r'"C:\Program Files (x86)\PostgreSQL\9.5\bin\pg_dump.exe" --dbname=postgresql://postgres:[email protected]:5432/db -f D:/backup/%s' % filename, shell=True
)
Everything works fine now
Upvotes: 2