user321553125
user321553125

Reputation: 3216

How to use mysql dump with django?

I am new to both django and mysql, I am given a mysql dump file that will be used in a django app. I created a new database and restored the dump file into that using mysqldump. Now I am lost about how to use both of them together. Please help.

Upvotes: 1

Views: 423

Answers (1)

mohammed_ayaz
mohammed_ayaz

Reputation: 679

Assuming that you have restored the dump on to your database.

Make django migrations

python manage.py makemigrations

Fake the migrations

python manage.py migrate --fake

Run the app

python manage.py runserver

On a side note, you can check if you have database credentials on in your settings.py of your application

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'mydatabase',
        'USER': 'mydatabaseuser',
        'PASSWORD': 'mypassword',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

Upvotes: 1

Related Questions