Welcome to django-archetype. This project serves as W+K's base django project. Please use it to get your django project up and running quickly. If you've got improvements or fixes to archetype, make a branch, and send them as a pull request!
-
Set up a github repo for your project (aka https://github.com/wieden-kennedy/myproject.git)
-
Clone this repo into your project name, and set up the remotes:
git clone git@github.com:wieden-kennedy/django-archetype.git archetype cd archetype git remote set-url origin git@github.com:wieden-kennedy/myproject.git git remote add archetype git@github.com:wieden-kennedy/django-archetype.git git push -u origin master
-
Set up a virtualenv, and re-freeze the requirements
mkvirtualenv myproject --no-site-packages workon myproject pip install -r requirements.unstable.txt pip freeze requirements.unstable.txt > requirements.txt
Note: If you're in rapid-deploy land, just use requirements.txt. It's guaranteed to be stable.
-
Copy
env/local.py.dist
toenv/local.py
, and set the name of your virtualenv in it. -
If you're using AWS (it's set up to, by default):
-
Place your keys into the environment variables, or set them in
local.py
-
Create whatever buckets you need:
./manage.py create_bucket
-
-
Set the domain in
apps/archetype/fixtures/initial_data.json
-
Run
./manage.py test
-
Run
./manage.py harvest --settings=env.lettuce -d
-
When both of the above pass, uncomment
"archetype",
inLETTUCE_AVOID_APPS
inenv/lettuce.py
-
Fill in the settings
ADMINS
, and set up theEMAIL_SUBJECT_PREFIX
in common.py -
Update README.md with your project's details.
-
Request production access.
-
Verify the email address you want to send from.
./manage.py shell_plus
from boto.ses.connection import SESConnection c = SESConnection(aws_access_key_id=settings.AWS_ACCESS_KEY_ID, aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY) c.verify_email_address("outgoingemail@example.com")
Archetype ships with django-analytical built-in. To add analytics, just add their IDs to the common.py
settings file.
For instance, to set up Google Analytics Gaug.es, and Mixpanel, add:
MIXPANEL_API_TOKEN = "0d123aa10022334455df12345678c"
GOOGLE_ANALYTICS_PROPERTY_ID = "UA-12345678-90"
GAUGES_SITE_ID = "0d123aa10022334455df12345678c"
-
Uncomment the heroku requirement from
requirements.unstable.txt
, install, and refreeze. -
Get the heroku gem, if you don't have it.
gem install heroku
-
Create a stack:
heroku create --stack cedar my_app
-
Add the heroku remote
git remote add heroku git@heroku.com:my_app.git
-
Add some typical services:
# Backups (Free) heroku addons:add pgbackups:auto-month # Redis (5MB, Free) heroku addons:add redistogo:nano # Memcached (5MB, Free) heroku addons:add memcache:5mb # Dev Database (Postgresql) heroku addons:add heroku-postgresql:dev # Add your domain (You'll need both for www. support.) heroku domains:add www.example.com heroku domains:add example.com
-
Set your domain's DNS:
-
Deploy (below)
- Get your
live
branch ready to go. - Re-freeeze the requirements, if you've changed them:
pip freeze requirements.unstable.txt > requirements.txt
fab deploy_heroku
heroku run python project/manage.py shell_plus
A base set of common fabric commands are included. Right now, that's:
deploy_static
- collects static, compresses them, and syncs them to S3.deploy_heroku
- full deploy to heroku. Specifically, it:
- Collects all the static files
- Combines and compress them
- Names them uniquely
- Uploads them, gzipped, with never-expire and proper CORS headers to the S3 bucket
- Pushes your code to heroku
- Runs
syncdb
- Runs
migrate
- Restarts your heroku server