Mezzanine--如何從sqllite轉換為Postgresql Database

Posted by: Max Chen | in Mezzanine | 1 year, 11 months ago |

Mezzanine--如何從sqllite轉換為Postgresql Database

1.把根目錄下的dev.db進行備份

    python manage.py dumpdata > whole.json --settings=investblog.settings_local

2.把dev.db刪除 如果有問題, 將每個app內的migrations與_pycache_的file刪除, 但有_init_的不要刪除.

  1. 更改setting.Pay

4.更改local_setting.py

當初就是不知道這邊的setting會覆蓋掉, setting中的, 所以搞了很久.

請看這裡

5.migrate

 python manage.py makemigrations

 python manage.py migrate

註:實驗過程中用到的特別Django語法

```
# 假的migrate
python manage.py migrate --fake
# 查詢migrate歷史
python manage.py showmigrations 
# 同步db
manage.py migrate --run-syncdb 
# 進入shell, 可以debug
python manage.py shell 
=>
import django
#查詢db connect是否正常 : No代表正常
print(django.db.connection.ensure_connection())
```

參考來源: https://stackoverflow.com/questions/43156053/mezzanine-django-1-10-migrations-database-tables-does-not-much-with-migrations https://stackoverflow.com/questions/52673215/start-mezzanine-project-with-custom-database https://stackoverflow.com/questions/59163167/django-postgresql-existing-database-does-not-exist https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html https://stackoverflow.com/questions/29253399/how-to-reset-migrations-in-django-1-7 https://medium.com/djangotube/django-sqlite-to-postgresql-database-migration-e3c1f76711e1 https://stackoverflow.com/questions/32098797/how-can-i-check-database-connection-to-mysql-in-django

tags:`Mezzanine
Currently unrated
 or 

Subscribe

* indicates required

Recent Posts

Archive

2023
2022
2021

Categories

Apache 1

Data Science 2

Dbfit 1

Design Pattern 1

Devops 4

DigitalOcean 1

Django 1

English 3

Excel 5

FUN 4

Flask 3

Git 1

HackMD 1

Heroku 1

Html/Css 1

Linux 4

MDX 1

Machine Learning 2

Manufacture 1

Master Data Service 1

Mezzanine 18

Oracle 1

Postgresql 7

PowerBI 4

Powershell 4

Python 22

SEO 2

SQL Server 53

SQL Server Analytics Service 1

SQLite 1

Windows 1

database 8

work-experience 1

其他 1

投資入門 1

投資心得 2

時間管理 1

總體經濟 2

自我成長 3

資料工程 1

Tags

SEO(1) Github(2) Title Tag(2) ML(1) 李宏毅(1) SQL Server(18) Tempdb(1) SSMS(1) Windows(1) 自我成長(2) Excel(1) python Flask(1) python(5) Flask(2)

Authors

Max Chen (159)

Feeds

RSS / Atom

Mezzanine--如何從sqllite轉換為Postgresql Database

© COPYRIGHT 2011-2022. Max的文藝復興. ALL RIGHT RESERVED.