First, load some data via the admin that should always be there when someone installs the app.
Next, dump that data out into JSON format into a fixture:
$ ./manage.py dumpdata [app_name] > [app_name]/fixtures/initial_data.json
This playbook has been removed as it is now very outdated. |
#!/bin/bash | |
# virtualenv-auto-activate.sh | |
# | |
# Installation: | |
# Add this line to your .bashrc or .bash-profile: | |
# | |
# source /path/to/virtualenv-auto-activate.sh | |
# | |
# Go to your project folder, run "virtualenv .venv", so your project folder | |
# has a .venv folder at the top level, next to your version control directory. |
""" | |
The MIT License (MIT) | |
Copyright (c) 2011 Numan Sachwani | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
of the Software, and to permit persons to whom the Software is furnished to do | |
so, subject to the following conditions: |
from boto.ec2.elb import ELBConnection | |
from boto.ec2.elb import HealthCheck | |
conn_elb = ELBConnection(AWS_ACCESS_KEY, AWS_SECRET_KEY) | |
#For a complete list of options see http://boto.cloudhackers.com/ref/ec2.html#module-boto.ec2.elb.healthcheck | |
hc = HealthCheck('healthCheck', | |
interval=20, | |
target='HTTP:80/index.html', |
#For a complete list of options see http://boto.cloudhackers.com/ref/ec2.html#boto.ec2.autoscale.policy.ScalingPolicy | |
scalingUpPolicy = ScalingPolicy(name='webserverScaleUpPolicy', | |
adjustment_type='ChangeInCapacity', | |
as_name='webserver-asg', | |
scaling_adjustment=2, | |
cooldown=180) | |
scalingDownPolicy = ScalingPolicy(name='webserverScaleDownPolicy', | |
adjustment_type='ChangeInCapacity', | |
as_name='webserver-asg', |
#For a complete list of options see http://boto.cloudhackers.com/ref/ec2.html#boto.ec2.autoscale.group.AutoScalingGroup | |
ag = AutoScalingGroup(group_name='webserver-asg', load_balancers=['my-lb'], | |
availability_zones=['us-east-1a','us-east-1b', 'us-east-1c'], | |
launch_config='my-launch-config-name', min_size=2, max_size=20) | |
conn_as.create_auto_scaling_group(ag) |
from boto.ec2.autoscale import AutoScaleConnection | |
from boto.ec2.autoscale import LaunchConfiguration | |
conn_as = AutoScaleConnection(AWS_ACCESS_KEY, AWS_SECRET_KEY) | |
#For a complete list of options see http://boto.cloudhackers.com/ref/ec2.html#boto.ec2.autoscale.launchconfig.LaunchConfiguration | |
lc = LaunchConfiguration(name='my-launch-config-name', image_id='ami-123456', | |
key_name='webserver-access-key', | |
security_groups=['webserver-security-group'], | |
instance_type='t1.micro', |
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
# |
################################################################################# | |
# Import modules | |
################################################################################# | |
import os | |
import time | |
import sys | |
import socket | |
import string |