django1.11.1 models 數(shù)據(jù)庫(kù)同步方法
在django1.9之前,數(shù)據(jù)庫(kù)同步只需要一條命令:python manage.py syncdb
在djang1.9以后,數(shù)據(jù)庫(kù)同步執(zhí)行指令如下:
同步數(shù)據(jù)庫(kù)接口(注意需要切換至python project工作空間所在路徑)
python manage.py makemigrations
同步數(shù)據(jù)
python manage.py migrations
最后登入http://localhost:8080/admin 發(fā)現(xiàn),已經(jīng)創(chuàng)建數(shù)據(jù)庫(kù)表。
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 數(shù)據(jù)庫(kù)同步方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
- 解決django同步數(shù)據(jù)庫(kù)的時(shí)候app models表沒(méi)有成功創(chuàng)建的問(wèn)題
- Django models.py應(yīng)用實(shí)現(xiàn)過(guò)程詳解
- Django 模型類(models.py)的定義詳解
- python Django中models進(jìn)行模糊查詢的示例
- Django的models中on_delete參數(shù)詳解
- Django的models模型的具體使用
- 淺談Django中的數(shù)據(jù)庫(kù)模型類-models.py(一對(duì)一的關(guān)系)
- Django中反向生成models.py的實(shí)例講解
- Django 根據(jù)數(shù)據(jù)模型models創(chuàng)建數(shù)據(jù)表的實(shí)例
- Django對(duì)models里的objects的使用詳解
相關(guān)文章
Python實(shí)現(xiàn)動(dòng)態(tài)循環(huán)輸出文字功能
這篇文章主要介紹了Python實(shí)現(xiàn)動(dòng)態(tài)循環(huán)輸出文字功能,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-05-05
python面向?qū)ο蠡A(chǔ)之常用魔術(shù)方法
這是我聽(tīng)老師上課做的筆記,文中有非常詳細(xì)的代碼示例及注釋,對(duì)新手及其友好,對(duì)正在學(xué)習(xí)python的小伙伴們也很有幫助,需要的朋友可以參考下2021-05-05
Python?pycharm提交代碼遇到?jīng)_突解決方法
這篇文章主要介紹了Python?pycharm提交代碼遇到?jīng)_突解決方法,文章圍繞主題展開(kāi)詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下2022-08-08
Python TCP通信客戶端服務(wù)端代碼實(shí)例
這篇文章主要介紹了Python TCP通信客戶端服務(wù)端代碼實(shí)例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-11-11
Python greenlet實(shí)現(xiàn)原理和使用示例
這篇文章主要介紹了Python greenlet實(shí)現(xiàn)原理和使用示例,greenlet是Python中的一個(gè)并行處理庫(kù),需要的朋友可以參考下2014-09-09
Python實(shí)現(xiàn)中一次讀取多個(gè)值的方法
下面小編就為大家分享一篇Python實(shí)現(xiàn)中一次讀取多個(gè)值的方法,具有很好的參考價(jià)值,我對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-04-04
國(guó)產(chǎn)化設(shè)備鯤鵬CentOS7上源碼安裝Python3.7的過(guò)程詳解
這篇文章主要介紹了國(guó)產(chǎn)化設(shè)備鯤鵬CentOS7上源碼安裝Python3.7,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-05-05

