"Unknown command syncdb" running "python manage.py syncdb"
Asked Answered
K

10

36

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

Knew answered 24/2, 2015 at 0:1 Comment(4)
Seems like you are a bit ahead of time maybe? :p Isn't django 1.8 in alpha?Tourniquet
have you tried python manage.py migrate docsDextrorse
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.Knew
A small discussion can be found here #21403149Qualmish
K
61

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

Kolivas answered 24/2, 2015 at 0:16 Comment(2)
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.Knew
how to load fixtures? before that it was very comfortableCrisscross
F
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"

Foreshadow answered 26/1, 2016 at 17:58 Comment(0)
M
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.

Mahmoud answered 6/12, 2017 at 12:20 Comment(1)
and what about fixture loading? it was very comfy with one commandCrisscross
T
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.

Tadtada answered 14/3, 2017 at 20:11 Comment(0)
O
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.

Ory answered 9/3, 2017 at 6:25 Comment(0)
S
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
Snotty answered 2/5, 2020 at 14:34 Comment(0)
P
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

Palpitate answered 15/1, 2016 at 15:27 Comment(0)
D
0

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

Dunkirk answered 15/3, 2016 at 6:50 Comment(0)
C
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.

Copy answered 20/4, 2017 at 17:4 Comment(0)
U
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

Uttermost answered 8/11, 2019 at 11:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.