how to create default users on django init_data?

被刻印的时光 ゝ 提交于 2019-12-12 12:10:01

问题


How can I loaddata for default list of users, when I syncdb ?


回答1:


What I do.

  1. Create users manually.

  2. Do a dumpdata for the auth.users table.

  3. After doing syncdb, do a loaddata for the dumped users.

It's not totally "automatic" because -- in the long run -- totally automatic is a terrible idea. Most syncdb operations involve database changes that also require you preserve some legacy data, perhaps dropping tables, and doing other "schema migration" steps. Each time it involves something special. So "total automation" rarely works out well.



来源:https://stackoverflow.com/questions/2864522/how-to-create-default-users-on-django-init-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!