You can create an initial set of Wagtail pages with theming and images and then export them for loading into another Django portal instance. These can be used to create starter themes or to fully develop a themed set of pages for an Airavata Django Portal.
These steps document how to create one of these exports locally.
django_airavata/settings_local.py
file and add the following at the bottom:AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend'] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', # Wagtail related middleware 'wagtail.core.middleware.SiteMiddleware', 'wagtail.contrib.redirects.middleware.RedirectMiddleware', ]
This allows you to log in locally, without needing to setup Keycloak or have an Airavata backend running.
source venv/bin/activate
python manage.py createsuperuser
python manage.py load_cms_data FILENAME
, where FILENAME is the name of one of the Wagtail exports in fixtures directory. For example, you can runpython manage.py load_cms_data default.json
python manage.py runserver
Once you have the pages just the way you want them, you can now export them.
source venv/bin/activate
python manage.py dumpdata --natural-foreign --exclude auth.permission \ --exclude contenttypes --indent 4 > django_airavata/wagtailapps/base/fixtures/myexport.json
Where you can change myexport
to whatever you want to meaningfully name the export file.
!!! warning
db.sqlite3 stores all of the Wagtail changes you have made. Only remove this if you have already exported the wagtail changes to a file. See the previous section.
rm db.sqlite3
source venv/bin/activate
python manage.py migrate
python manage.py createsuperuser
python manage.py load_cms_data FILENAME
, where FILENAME is the name of one of the Wagtail exports in fixtures directory. For example, you can runpython manage.py load_cms_data default.json
python manage.py runserver
You can import a Wagtail export by running the following command on a newly created Django instance.
source venv/bin/activate
python manage.py load_cms_data myexport.json
where myexport.json
should match the name that you gave the file when exporting it.
Use this when you have already loaded a Wagtail export into a Django instance and you need to load a different one to overwrite the first one. The following steps will first remove the Wagtail tables and then load the export like normal.
source venv/bin/activate
python manage.py migrate wagtailimages 0001 python manage.py migrate wagtailimages zero python manage.py migrate taggit zero python manage.py migrate wagtailadmin zero python manage.py migrate wagtailcore zero python manage.py migrate wagtailusers zero python manage.py migrate wagtailembeds zero
python manage.py migrate
python manage.py load_cms_data myexport.json
where myexport.json
should match the name that you gave the file when exporting it.