Programmatically sync the db in Django
Posted
by Attila Oláh
on Stack Overflow
See other posts from Stack Overflow
or by Attila Oláh
Published on 2010-05-05T12:06:48Z
Indexed on
2010/05/05
12:38 UTC
Read the original article
Hit count: 271
I'm trying to sync my db from a view, something like this:
from django import http
from django.core import management
def syncdb(request):
management.call_command('syncdb')
return http.HttpResponse('Database synced.')
The issue is, it will block the dev server by asking for user input from the terminal. How can I pass it the '--noinput'
option to prevent asking me anything?
I have other ways of marking users as super-user, so there's no need for the user input, but I really need to call syncdb
(and flush
) programmatically, without logging on to the server via ssh. Any help is appreciated.
© Stack Overflow or respective owner