Wagtail connect to MySQL and import data
Asked Answered
S

1

5

I've recently followed the Wagtail documentation for creating a Wagtail website with blog. I want to use a MySQL database instead of the sqlite3 database which it creates automatically. Python is a new language for me, and I can see in the base.py a section for DATABASES which includes the ENGINE and NAME - but I am unused to the format below compared to a PHP connection:

'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}

I want to connect to a MySQL database I have set up via my wampserver, and import the data (pages etc) from the sqlite3 database, how would I proceed to do this?

Sorgo answered 11/12, 2018 at 14:9 Comment(0)
L
8

It is just a matter of changing database engine type to MySQL and providing correct username and password for that database. Rest will be taken care by Wagtail.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'db_name',
        'USER': 'user_name',
        'PASSWORD': 'password'
    },
}
Longmire answered 2/4, 2019 at 12:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.