Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Accepted Answer
Hey!
Are you using the DigitalOcean App Platform? If this is the case, the best approach here would be to use a managed MySQL cluster.
Using SQLite with the App Platform is not recommended as the App Platform has ephemeral storage, meaning that any data you store on the App Platform itself locally, will be lost after each redeployment.
To set up MySQL in your Python Django project on DigitalOcean, and resolve the issue of empty tables when migrating, follow these steps:
Create a MySQL Cluster:
Install Django MySQL Adapter:
pip install mysqlclient
Update settings.py:
Open your Django project’s settings.py file and update the DATABASES setting:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'your_database_name',
'USER': 'your_mysql_user',
'PASSWORD': 'your_mysql_password',
'HOST': 'your_mysql_host', # e.g., 'db-mysql-nyc3-12345-do-user-67890-0.b.db.ondigitalocean.com'
'PORT': 'your_mysql_port', # e.g., '25060'
}
}
Replace your_database_name, your_mysql_user, your_mysql_password, your_mysql_host, and your_mysql_port with the details from your DigitalOcean Managed MySQL Database.
After that redeploy your project to the App Platform.
Let me know how it goes!
Best,
Bobby
Heya @zappcodeacademy,
The data you have in your SQLLITE db will not automatically migrate over to the MySQL.
Yes, you can run your migrations to create the structure of your DB in MySQL however you’ll need to find another way to dump the data from your SQLLITE to MySQL.
Let’s first make sure you ahve the proper stuff in your settings.py file:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'myproject',
'USER': 'myprojectuser',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '',
}
}
python manage.py makemigrations python manage.py migrate
python manage.py dumpdata > datadump.json
python manage.py migrate --run-syncdb
python manage.py loaddata datadump.json