没有指定安装django版本时,都会自动安装最新版本。
而django从1.9版本后,相关命令已经变化。
如下为同步数据库,
[root@Centos7-33 mydjango]# python3 manage.py makemigrations
No changes detected
[root@Centos7-33 mydjango]# python3 manage.py makemigrations app01
Migrations for 'app01':
app01/migrations/0001_initial.py:
- Create model Author
- Create model Book
- Create model Publisher
- Create model user
- Add field publisher to book
[root@Centos7-33 mydjango]# python3 manage.py migrate
Operations to perform:
Apply all migrations: admin, app01, auth, contenttypes, sessions
Running migrations:
Applying app01.0001_initial... OK
查看数据库数据:
[root@Centos7-33 mydjango]# mysql -uroot -p'Aaxxxxx' -U linweb -e 'show tables;'
mysql: [Warning] Using a password on the command line interface can be insecure.
+----------------------------+
| Tables_in_linweb |
+----------------------------+
| app01_author |
| app01_book |
| app01_book_authors |
| app01_publisher |
| app01_user |
| auth_group |
| auth_group_permissions |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| django_admin_log |
| django_content_type |
| django_migrations |
| django_session |
+----------------------------+
如图: