How to supply parameters to "python manage.py syncdb" from a script?
52 views
Skip to first unread message
Dan Dong
unread,
Mar 20, 2015, 6:12:21 PM3/20/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Hi, Does anybody know how to supply the input parameters to "python manage.py syncdb" from a script? E.g, to set the the followings parameters:
Would you like to create one now? (yes/no): yes Username (leave blank to use 'root'): Email address: xxxxxxxxx Password: xxxxxx Password (again): xxxxxx
Cheers, Dan
Russell Keith-Magee
unread,
Mar 20, 2015, 7:27:12 PM3/20/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django Users
You don't - and that's by design.
If you're putting a password into a script, then that script is in plain text, and so is your password - so you've just lost your security.
So - you don't pass input parameters to the script. You run the script with the --noinput flag, which will prevent the script from prompting for user input.
If you want to have an initial user in your database after syncdb, put that user's data in a fixture, and load the fixture as part of the script. The fixture will contain the password in a hashed format, so the password will be protected.
Yours,
Russ Magee %-)
Dan Dong
unread,
Mar 23, 2015, 11:08:07 AM3/23/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message