freedomofpress / securethenews

An automated scanner and web dashboard for tracking TLS deployment across news organizations
https://securethe.news
GNU Affero General Public License v3.0
102 stars 25 forks source link

Management command for populating dev environment #72

Closed garrettr closed 7 years ago

garrettr commented 7 years ago

manage.py createdevdata builds a basic site which resembles Secure the News. It also adds a set of Sites and Scans to the database. You can run this (after the initial database migration) to get a reasonable imitation of the Secure the News production site up and running, which is useful for development.

Previously, all development data was loaded from fixtures. This was overly brittle and required lots of updates to the fixtures (pretty much whenever we added or changed a model). This PR changes things so createdevdata builds the Wagtail site programmatically, which is easier to understand and extend/maintain. Sites and Scans are still loaded from fixtures, because it is more annoying to generate that data programmatically.

Updates the README accordingly, so first-time contributors to Secure the News should be able to get up and running quickly with the new workflow.

Future work

Could be addressed in this PR, or in follow-ups.

conorsch commented 7 years ago

Taking this for a spin now.

garrettr commented 7 years ago

Rebased on top of master.

msheiny commented 7 years ago

I took to test this through the workflow under the devops folder but working good for me :+1:

Really like the programmatic fixture code in createdevdata.py -- good idea shoving the test admin create down there too. You da best

conorsch commented 7 years ago

Also good for me. I used the competing vagrant workflow with a libvirt backend and it worked like a dream, was able to view a populated leaderboard on the local forwarded port. Great work, @garrettr!

During testing I screwed up and didn't rm the sqlite database, which caused the createdevdata task to fail. Mentioning this in case someone bumps into that problem again.