django1.11.1 models 數(shù)據(jù)庫同步方法
在django1.9之前,數(shù)據(jù)庫同步只需要一條命令:python manage.py syncdb
在djang1.9以后,數(shù)據(jù)庫同步執(zhí)行指令如下:
同步數(shù)據(jù)庫接口(注意需要切換至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ù)庫表。
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ù)庫同步方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
- 解決django同步數(shù)據(jù)庫的時候app models表沒有成功創(chuàng)建的問題
- Django models.py應用實現(xiàn)過程詳解
- Django 模型類(models.py)的定義詳解
- python Django中models進行模糊查詢的示例
- Django的models中on_delete參數(shù)詳解
- Django的models模型的具體使用
- 淺談Django中的數(shù)據(jù)庫模型類-models.py(一對一的關系)
- Django中反向生成models.py的實例講解
- Django 根據(jù)數(shù)據(jù)模型models創(chuàng)建數(shù)據(jù)表的實例
- Django對models里的objects的使用詳解
相關文章
Python實現(xiàn)動態(tài)循環(huán)輸出文字功能
這篇文章主要介紹了Python實現(xiàn)動態(tài)循環(huán)輸出文字功能,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下2020-05-05Python?pycharm提交代碼遇到?jīng)_突解決方法
這篇文章主要介紹了Python?pycharm提交代碼遇到?jīng)_突解決方法,文章圍繞主題展開詳細的內(nèi)容介紹,具有一定的參考價值,需要的小伙伴可以參考一下2022-08-08Python greenlet實現(xiàn)原理和使用示例
這篇文章主要介紹了Python greenlet實現(xiàn)原理和使用示例,greenlet是Python中的一個并行處理庫,需要的朋友可以參考下2014-09-09國產(chǎn)化設備鯤鵬CentOS7上源碼安裝Python3.7的過程詳解
這篇文章主要介紹了國產(chǎn)化設備鯤鵬CentOS7上源碼安裝Python3.7,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-05-05