A
A
Anton2015-12-02 13:36:49
Django
Anton, 2015-12-02 13:36:49

How to recreate a database for a Django project?

We need to make Django think that the database did not previously exist. So that you can run migrations from the beginning.
How to achieve this?
I deleted the file from the old database. But when I try to create/perform migrations, I get an error pointing to a table from a remote database. How to destroy these connections?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
zelsky, 2015-12-02
@zelsky

Create a new table and register it in the config, and then do the migrations

S
Sergey, 2015-12-02
@bogdanov-s

Delete the migrations folder, drop the database and run
python manage.py migrate --fake-initial

I
Ilya Pavlov, 2015-12-03
@Spirkaa

django-extensions has a reset_db command:

python manage.py reset_db
python manage.py migrate
python manage.py createsuperuser

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question