cppcoder
cppcoder

Reputation: 23105

How to syncdb in django 1.7

Directory structure

MyDjangoWebsite
|MyDjangoWebsite
|manage.py
|MyBlog
|models.py
|__init__.py
|views.py
|migrations

MyBlog is the app I created using startapp command. I have added a class in MyBlog/models.py.

When I run python manage.py syncdb or python manage.py migrate, I get No migrations to apply.

I am using django 1.7. Please let me know how can I add my tables to database.

Upvotes: 1

Views: 1432

Answers (1)

Burhan Khalid
Burhan Khalid

Reputation: 174624

The steps to follow are:

  1. Make changes in models
  2. Run manage.py makemigrations - this is what generates the migrations file, which lists the changes that need to be applied (the migrations).
  3. Run manage.py migrate - this will apply the migrations created by makemigrations.

If you skip step #2, then there are no migration (nothing to "migrate") so that's why you get that message.

As 1.7 was released, the tutorial was also updated and now includes a section on migrations which I would recommend going over.

Upvotes: 1

Related Questions