Upgrade 5.1.x to 6.x¶
If you want to migrate your site from T5 to the latest version of tendenci T7, you’d need to take two steps because of the change in the way django switched database migration methods moving to django 1.8. For Tendenci this means you must:
Migrate from T5 to T6
Migrate from T6 to T7
In this guide, we’ll show you how to migrate from T5 to T6.
In general, to migrate your site from T5 to T6, you’d need to set up a T6 site, update the theme to fit your needs, then move the database and media files from your T5 site to the new T6 site.
1. Set up a T6 site¶
The instruction here can help you to get your T6 site set up.
You might also need to look at this guide for information on server setup.
Note: Please write down your T6’s current theme name, you will need it in the last step. The current theme name can be found in the theme editor.
2. Dump database and zip the media files on your T5 site¶
mkdir /tmp/<site_name> && cd /tmp/<site_name>
sudo -u postgres pg_dump <db_name> --file=<db_name>.dump --host=localhost --username=<db_user>
tar -C <path-to-site>/media -czvf <site_name>_media.tar.gz .
If your T5 and T6 sites are not on the same server, you’ll need to move (with scp) the database dump and media .gz file to your T6 server.
3. Restore database on your T6 site¶
If your T5 and T6 sites are on the same server, skip this step.
# create and restore database
sudo -u postgres psql
CREATE USER <db_user> WITH PASSWORD '<db_password>';
CREATE DATABASE <db_name> WITH OWNER <db_user>;
GRANT ALL PRIVILEGES ON DATABASE <db_name> TO <db_user>;
# type '\q' to quit psql
sudo -u postgres psql -d <db_name> --file=<db_name>.dump
sudo -u postgres psql -d <db_name> -c "CREATE EXTENSION postgis;"
# restore media files
tar -C <path-to-site>/media -xzvf /tmp/<site_name>/<site_name>_media.tar.gz
After that, update the DATABASES setting in the conf/local_settings.py.
4. Copy over site specific settings from T5 .env and conf/local_settings.py¶
It can include but may not limit to the following:
SECRET_KEY
SITE_SETTINGS_KEY
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
DEFAULT_FROM_EMAIL
# payment gateway settings
# newsletters settings
5. Migrate database¶
python manage.py clear_cache
python manage.py syncdb
python manage.py migrate
# We had to run the following commands. But your mileage may vary.
python manage.py migrate social_auth 0001 --fake
python manage.py migrate wp_exporter 0001 --fake
python manage.py migrate djcelery 0001 --fake
python manage.py migrate --delete-ghost-migrations
python manage.py migrate user_groups 0012 --fake
python manage.py migrate social_auth 0001 --fake
python manage.py migrate wp_exporter 0001 --fake
python manage.py migrate djcelery 0001 --fake
python manage.py migrate wp_importer 0001 --fake
python manage.py migrate wp_importer 0001 --fake
6. Run deploy.py¶
python deploy.py
7. Set theme¶
Use the theme name you wrote down in step 1.
python manage.py set_theme <your current theme>
8. Clear caches¶
python manage.py clear_cache
python manage.py clear_theme_cache
Sometimes things can be bumpy depending on your database’s state. Stay cool and try to debug. Seek help if you’re not able to resolve yourself.
Finally, restart your new T6 site.
Note
If you want to copy over the theme from your T5 site to T6/T7:
Make sure the theme is bootstrap 3 compatible.
Update templates to replace {% block body %} with {% block content %}.
Update templates to add quotes to the first argument of url tags. For example, if you have url tag {% url admin:boxes_box_change box.pk %}, it needs to be updated to {% url ‘admin:boxes_box_change’ box.pk %}.