Locally restore wagtail postgres database and fix Wagtail preview - fecgov/fec-cms GitHub Wiki
Locally restore wagtail postgres database
Get a copy of the dump file and place within fec-cms project root.
cd to project root folder
cd [fec-cms-project-root-dir]
Drop current cfdm database
dropdb cfdm_cms_test
Create new database
createdb cfdm_cms_test
Restore from dump file
pg_restore --dbname cfdm_cms_test --no-acl --no-owner <dump_file_name>
Go to fec directory (that's where the manage.py file is stored)
cd fec/
Run migrate for new database
./manage.py migrate
Create user
./manage.py createsuperuser
Start-up wagtail app
./manage.py runserver
Fix Wagtail preview functionality on your local environment
After restoring your Wagtail database on your local development environment, you may notice that your Wagtail page preview functionality is broken. You'll need to update your local Wagtail settings to fix it.
- Go into your local Wagtail admin
- In the left hand navigation, go to "Settings" --> "Sites"
- Click on the "fec.gov" site to edit
- Update hostname to either "localhost" or "127.0.0.1"
- Update the port to "8000"
- Save and test any page to preview, it should now work.