django1.11.1 models 数据库同步方法
更新时间:2018年05月30日 10:29:39 作者:在奋斗的大道
今天小编就为大家分享一篇django1.11.1 models 数据库同步方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
在django1.9之前,数据库同步只需要一条命令:python manage.py syncdb
在djang1.9以后,数据库同步执行指令如下:
同步数据库接口(注意需要切换至python project工作空间所在路径)
python manage.py makemigrations
同步数据
python manage.py migrations
最后登入http://localhost:8080/admin 发现,已经创建数据库表。
windows10 cmd窗口指令
D:\user_workspace>python manage.py makemigrations Migrations for 'blog': blog\migrations\0001_initial.py - Create model BlogPost
D:\user_workspace>python manage.py migrate Operations to perform: Apply all migrations: admin, auth, blog, contenttypes, sessions Running migrations: Applying contenttypes.0001_initial... OK Applying auth.0001_initial... OK Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying contenttypes.0002_remove_content_type_name... OK Applying auth.0002_alter_permission_name_max_length... OK Applying auth.0003_alter_user_email_max_length... OK Applying auth.0004_alter_user_username_opts... OK Applying auth.0005_alter_user_last_login_null... OK Applying auth.0006_require_contenttypes_0002... OK Applying auth.0007_alter_validators_add_error_messages... OK Applying auth.0008_alter_user_username_max_length... OK Applying blog.0001_initial... OK Applying sessions.0001_initial... OK
以上这篇django1.11.1 models 数据库同步方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
Mac上Python使用ffmpeg完美解决方案(避坑必看!)
ffmpeg是一个强大的开源命令行多媒体处理工具,下面这篇文章主要给大家介绍了关于Mac上Python使用ffmpeg完美解决方案的相关资料,文中通过实例代码介绍的非常详细,需要的朋友可以参考下2023-02-02
Sentry的安装、配置、使用教程(Sentry日志手机系统)
Sentry 是一个实时事件日志记录和聚合平台,由于ExceptionLess官方提供的客户端只有.Net/.NetCore平台和js的,本文继续介绍另一个日志收集系统Sentry,感兴趣的朋友一起看看吧2022-07-07
Pytorch使用MNIST数据集实现基础GAN和DCGAN详解
今天小编就为大家分享一篇Pytorch使用MNIST数据集实现基础GAN和DCGAN详解,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2020-01-01


最新评论