Django: What are the best practices to migrate a project from sqlite to PostgreSQL

后端 未结 7 1207
礼貌的吻别
礼貌的吻别 2020-12-04 10:25

I need to migrate a complex project from sqlite to PostgreSQL. A lot of people seems to have problem with foreign keys, data truncature and so on...

  • Is there a
7条回答
  •  时光说笑
    2020-12-04 10:59

    According to the @Nimo answer, used from "syncdb", "syncdb" doesn't work in Django 1.9 and later (that works on Django 1.7)

    Instead of that, use the command below:

    python manage.py migrate


    And Postgres setting configuration is here:

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': 'myproject',
            'USER': 'myprojectuser',
            'PASSWORD': 'password',
            'HOST': 'localhost',
            'PORT': '',
        }
    }
    

提交回复
热议问题