2

I already have an existing website running and want to transfer just the users (usernames, passwords and emails) to another database for a separate Django website as I am rebuilding it.

Kareem
  • 569
  • 2
  • 18

1 Answers1

2

You can configure both databases in your django configuration file. select the user data from one database and then put the records in the other.

Multiple Databases in Django.

Moving an object from one database to another

Gytree
  • 542
  • 3
  • 13
  • The thing is I don't want to be using dbsqlite 3 anymore as it is just a development server and will still like to keep the users I have now is there not a way to do something like . python manage.py dumpdata users > users.json – Kareem May 18 '18 at 22:12
  • 1
    But you don't need use only sqlite in your config. the database backend can be a PostgreSQL, so you can select the user data usin **users = get_user_model().object.using('default').all()** and then use **get_user_model().object.using('otherdb').bulk_create(users)** is Not what you're looking for? – Gytree May 18 '18 at 22:19
  • I dont quite understand what your trying to say, so what I do is I set up django to use both databases then run those commands in the django python shell then the users will exist on that databse – Kareem May 18 '18 at 22:23
  • see the second link – Gytree May 18 '18 at 22:28