This short recipe demonstrates how to create Wagtail pages programmatically. It may also be useful for testing Wagtail development against a reasonable volume of page data (about 35,000 film plots, from English Wikipedia).
In a virtualenv:
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| # | |
| # Updated to use Python 3 by Malcolm Greaves. | |
| # | |
| # Python script to find the largest files in a git repository. | |
| # The general method is based on the script in this blog post: | |
| # http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/ | |
| # | |
| # The above script worked for me, but was very slow on my 11GB repository. This version has a bunch |
| #!/bin/sh | |
| # Install Homebrew | |
| which brew > /dev/null 2>&1 | |
| if [ $? -eq 1 ]; then | |
| #Cheat, if we don't have brew, install xcode command line utils too | |
| xcode-select --install | |
| /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| else |
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: Cognito Stack | |
| Parameters: | |
| AuthName: | |
| Type: String | |
| Description: Unique Auth Name for Cognito Resources | |
| Resources: | |
| # Creates a role that allows Cognito to send SNS messages | |
| SNSRole: |
| import sys; reload(sys); sys.setdefaultencoding('utf-8') | |
| import sqlite3 | |
| import urllib2 | |
| import urllib | |
| import simplejson | |
| login = 'your github id' | |
| token = 'your github api key' | |
| repo = 'username/reponame' |