Reputation: 211
I have a server using django. I'm trying to switch my database from sqlite3 to mysql. Everything worked fine with sqlite3 before. However, when I use mysql and do
python manage.py syncdb
I didn't get any error, but the tables specified in models.py are not created. Only the following tables are created:
[ec2-user@domU-12-31-39-0F-D2-F3 prototype]$ python manage.py syncdb
Syncing...
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table south_migrationhistory
Anyone know why?
Upvotes: 2
Views: 9253
Reputation: 86
I found another solution:
DATABASES['default']
in settings point to this dbThis will create new and clear db structure
ALTER table db1.table_name RENAME db2.table_name
Thats all, thanks
Upvotes: 0
Reputation: 1462
It might be also the case that you inherited your model class from object and not from models.Model
The table will not be created. And no error will be raised
Upvotes: 0
Reputation: 10919
You have south installed.
When you run python manage.py syncdb
it syncs all the non-south managed apps.
run python manage.py migrate
to sync the other apps.
this is a tutorial I ran some of my coworkers through (the official south docs are more in depth, I had 15 minutes to get them on south and productive): https://gist.github.com/fyaconiello/2423447
Upvotes: 3
Reputation: 19973
It looks like you are using South. Normally South would inhibit the creation of most tables in the syncdb, and you'd be expected to run your South migrations to create them for the first time. This is so South can keep track of the state of your tables and apply any special migration rules you have, even initially.
The other possibility is that you don't have all of your apps listed in your INSTALLED_APPS
variable in the settings file.
Upvotes: 5