Ensure your machine can connect to mysql database, for that you shall install mysqlclient
check https://docs.djangoproject.com/fr/1.11/ref/databases/#mysql-notes ( I took Django 1.11 reference as it is the one I used in pod v2.8, podv3 uses later versions of Django and can thus use latest version of mysqlclient )
sudo apt install build-essential python3-dev default-libmysqlclient-dev pkg-config
pip install mysqlclient==1.3.13
Dump data from existing database
First dump authentication modules (they were a prerequisite for some other objects to reference them as foreign keys)
python manage.py dumpdata <module> --indent 2 > dump-<module>.json
#-> main
#-> auth.User
#-> authentication.AccessGroup
#-> authentication.Owner
Then dump the remaining of the database ( I removed podfiles as I was not using them anymore and they were making my migration fail )
python manage.py dumpdata --all --indent 2 --exclude podfile > dump-nopodfile.json
Clean dump-nopodfile if you must (I had one unneeded completion track )
Have a database ready (via docker: https://mariadb.com/kb/en/installing-and-using-mariadb-via-docker/ or on your system: https://mariadb.com/kb/en/distributions-which-include-mariadb/ )
Edit your settings_local.py to change your database connection (see Mise en production de la plateforme Pod V3 )
Create tables on this database
python manage.py migrate --run-syncdb
Modify pod/authentication/models.py (x2 modifications) to avoid cascade creation of users when doing loaddata (not sure it is needed if you import in the right order but it doesn't hurt)
# PATCH added raw parameter to avoid creation durin DB import
@receiver(post_save, sender=User)
def create_owner_profile(sender, instance, created, raw=False, **kwargs):
if created and not raw:
#### and somewhere else
#PATCH updated for migrations
@receiver(post_save, sender=Group)
def create_groupsite_profile(sender, instance, created, raw=False, **kwargs):
if created and not raw:
Load data in the mariadb instance in this order
First the authentication tables
python manage.py loaddata <dumpfilename>.json
#-> main
#-> auth.User
#-> authentication.AccessGroup
#-> authentication.Owner
Then the remaining of the database:
python manage.py loaddata dump-nopodfile.json
Then test your site to see if everything is correct