LightMatter Django Template |
---|
A generic template for Django 1.6 |
Instructions |
===================== |
Follow the steps below to start a new project using this django template: |
|
|
|
|
|
|
Deployment |
===================== |
This is ment to be deployed on the heroku |
Create a heroku application and push the code there. You will need to set: |
- The DJANGO_SETTINGS_MODULE variable to either "{{project_name}}.settings.heroku" or heroku_staging |
- The aws settings in AWS_SECRET_ACCESS_KEY, AWS_STORAGE_BUCKET_NAME, AWS_ACCESS_KEY_ID |
|
You can set the variables using the heroku command, the config:set argument and the --app flag: |
`heroku config:set DJANGO_SETTINGS_MODULE={{project_name}}.settings.heroku-staging ` |
or |
|
Use the Mandrill addon to setup email - |
|
Make sure to add psql backup |
|
Add in the newrelic addon: |
|
After pushing the code, you'll need to syncdb and run the initial migrations: |
|
Todo |
===================== |
Things we still want to do: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TRANSFERRING DATA |
make sure the pgbackups script is installed on staging and prod
LOCAL TO REMOTE
Back up your local data via `pg_dump -Fc --no-acl --no-owner <DBNAME> > database.dump
put the dump in a world readable location - dropbox works, or s3 use heroku pgbackups:restore DATABASE_URL '<url to your dump file>'
` make sure to use the url to the raw file and not an html document talking about the file (eg dropbox, right click on save file and click copy file url)
REMOTE TO LOCAL
Create a database dump with `$ heroku pgbackups:capture
Download it locally with $ curl -o latest.dump `heroku pgbackups:url
and load into your local db with
$ pg_restore --verbose --clean -U <DB_USER_NAME> -W --no-acl --no-owner -d <DB_NAME> latest.dumpREMOTE TO REMOTE (staging to prod, or prod to staging) Create a database dump with
$ heroku pgbackups:captureand load remotely with
heroku pgbackups:restore DATABASE_URL `heroku pgbackups:url```