Migrate DB To MySQL (Pythonanywhere) - koglak/SWE573 GitHub Wiki

1) Go File Menu in Pythonanywhere, find the path where your manage.py and db.sqlite3 documents. Copy the path!

image

2) Go your bash terminal and go the path you copied!

 cd /home/koglak/koglak.pythonanywhere.com

3) Install mysqlclient!

pip install mysqlclient

4) Go to Databases Menu and Create your password!

Note that password. You will use it later!

5) Enter a database name:

image

6) Note marked informations!

image

7) Find your setting.py file in file menu and click it!

image

8) Find your database code. It supposed to be like below

image

9) Update your code!

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'koglak$default',  
        'USER': 'koglak',
        'PASSWORD': '123456', #use your password here!
        'HOST': 'koglak.mysql.pythonanywhere-services.com',
        'OPTIONS': {
            "init_command": "SET sql_mode='STRICT_TRANS_TABLES'",
        }
    }
}

10) Don't Forget to Save! 🥳

image