34

I want to create the tables of one database called "database1.sqlite", so I run the command:

python manage.py syncdb

but when I execute the command I receive the following error:

Unknown command: 'syncdb' Type 'manage.py help' for usage.

But when I run

manage.py help

I don`t see any command suspicious to substitute

python manage.py syncdb

Version of Python I use: 3.4.2 Version of Django I use:1.9

I would be very grateful if somebody could help me to solve this issue.

Regards and thanks in advance

karthikr
  • 97,368
  • 26
  • 197
  • 188
lanz
  • 481
  • 1
  • 5
  • 10
  • 1
    Seems like you are a bit ahead of time maybe? :p Isn't django 1.8 in alpha? – ArchiFloyd Feb 24 '15 at 00:06
  • have you tried `python manage.py migrate` [docs](https://docs.djangoproject.com/en/1.7/topics/migrations/) – akotian Feb 24 '15 at 00:16
  • Gracias por su apoyo. Su resuelto @Archi --> I installed the beta version 1.9. As I am using a videotutorial to learn Django I have decided to install the same version the videotutorial is using the 1.6.2 one. – lanz Feb 24 '15 at 11:35
  • A small discussion can be found here https://stackoverflow.com/questions/21402649/what-is-the-difference-between-syncdb-and-migrate – Nabin Sep 23 '17 at 04:03

10 Answers10

59

If you look at the release notes for django 1.9, syncdb command is removed.

Please use migrate instead. Moving forward, the migration commands would be as documented here

Please note that the django-1.9 release is not stable as of today.

Edit: Django 1.9 is stable now

karthikr
  • 97,368
  • 26
  • 197
  • 188
  • Thanks for your support. Solved @Archi --> I installed the beta version 1.9. As I am using a videotutorial to learn Django I have decided to install the same version the videotutorial is using the 1.6.2 one. – lanz Feb 24 '15 at 11:41
  • how to load fixtures? before that it was very comfortable – holms Mar 09 '18 at 15:47
8

the new django 1.9 has removed "syncdb", run "python manage.py migrate", if you are trying to create a super user, run "python manage.py createsuperuser"

Sheikh Arham
  • 91
  • 1
  • 3
7

$python manage.py syncdb is deprecated and not supported now. So instead of this follow below instructions..

Whatever model you have created: First run:

$python manage.py makemigrations

After running this command you model will be reflected in a migration.

Then you have to run:

$python manage.py migrate

Then run server:

$python manage.py runserver

Now, your project will run perfectly.

Premjeet
  • 302
  • 3
  • 7
2

In Django 1.9 onwards syncdb command is removed. So instead of use that one, you can use migrate command,eg: python manage.py migrate.Then you can run your server by python manage.py runserver command.

PyDevSRS
  • 1,715
  • 16
  • 17
1

Django has removed python manage.py syncdb command now you can simply use python manage.py makemigrations followed bypython manage.py migrate. The database will sync automatically.

1

I had the same problem, the only thing worked for me was this command.

python3 manage.py migrate --run-syncdb

Running this got me this result.

Ranvijays-Mac:djangodemo rana.singh$ python3 manage.py migrate --run-syncdb
Operations to perform:
  Synchronize unmigrated apps: messages, staticfiles
  Apply all migrations: admin, auth, contenttypes, msg, sessions
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
Running migrations:
  Applying msg.0001_initial... OK
Rana Ranvijay Singh
  • 6,055
  • 3
  • 38
  • 54
0

You can run the command from the project folder as: "python.exe manage.py migrate", from a commandline or in a batch-file. You could also downgrade Django to an older version (before 1.9) if you really need syncdb.

For people trying to run Syncdb from Visual Studio 2015: The option syncdb was removed from Django 1.9 (deprecated from 1.7), but this option is currently not updated in the context menu of VS2015.

Also, in case you didn't get asked to create a superuser you should manually run this command to create one: python.exe manage.py createsuperuser

Daan
  • 49
  • 3
0

Run the command python manage.py makemigratons,and than python manage.py migrate to sync.

cwjwhu
  • 1
0

Alternarte Way:

  1. Uninstall Django Module from environment
  2. Edit Requirements.txt a type Django<1.9
  3. Run Install from Requirments option in the enviroment
  4. Try Syncdb again

This worked for me.

Fernando
  • 51
  • 6
0

I also tried this command. Lastly I found the release note from django

Features removed in 1.9

The syncdb command is removed.

Djnago Releases note 1.9

enter image description here

Chandan Sharma
  • 2,321
  • 22
  • 22