mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #21479 -- Favor 'migrate' over 'syncdb' in the docs.
This commit is contained in:
parent
b6a6cf4ab7
commit
27f04e79b1
9 changed files with 34 additions and 33 deletions
|
@ -263,9 +263,9 @@ that, run the following command:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ python manage.py syncdb
|
||||
$ python manage.py migrate
|
||||
|
||||
The :djadmin:`syncdb` command looks at the :setting:`INSTALLED_APPS` setting
|
||||
The :djadmin:`migrate` command looks at the :setting:`INSTALLED_APPS` setting
|
||||
and creates any necessary database tables according to the database settings
|
||||
in your :file:`mysite/settings.py` file. You'll see a message for each
|
||||
database table it creates, and you'll get a prompt asking you if you'd like to
|
||||
|
@ -281,8 +281,8 @@ display the tables Django created.
|
|||
Like we said above, the default applications are included for the common
|
||||
case, but not everybody needs them. If you don't need any or all of them,
|
||||
feel free to comment-out or delete the appropriate line(s) from
|
||||
:setting:`INSTALLED_APPS` before running :djadmin:`syncdb`. The
|
||||
:djadmin:`syncdb` command will only create tables for apps in
|
||||
:setting:`INSTALLED_APPS` before running :djadmin:`migrate`. The
|
||||
:djadmin:`migrate` command will only create tables for apps in
|
||||
:setting:`INSTALLED_APPS`.
|
||||
|
||||
.. _creating-models:
|
||||
|
@ -510,17 +510,17 @@ If you're interested, also run the following commands:
|
|||
Looking at the output of those commands can help you understand what's actually
|
||||
happening under the hood.
|
||||
|
||||
Now, run :djadmin:`syncdb` again to create those model tables in your database:
|
||||
Now, run :djadmin:`migrate` again to create those model tables in your database:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ python manage.py syncdb
|
||||
$ python manage.py migrate
|
||||
|
||||
The :djadmin:`syncdb` command runs the SQL from :djadmin:`sqlall` on your
|
||||
The :djadmin:`migrate` command runs the SQL from :djadmin:`sqlall` on your
|
||||
database for all apps in :setting:`INSTALLED_APPS` that don't already exist in
|
||||
your database. This creates all the tables, initial data and indexes for any
|
||||
apps you've added to your project since the last time you ran syncdb.
|
||||
:djadmin:`syncdb` can be called as often as you like, and it will only ever
|
||||
apps you've added to your project since the last time you ran :djadmin:`migrate`.
|
||||
:djadmin:`migrate` can be called as often as you like, and it will only ever
|
||||
create the tables that don't exist.
|
||||
|
||||
Read the :doc:`django-admin.py documentation </ref/django-admin>` for full
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue