This site has moved, this is just for reference, please visit the current one.

P Bergqvist

Deploying to with secret stuff

Published: mars 27, 2011

Tags: deployment django mac python windows


A while ago I got an invite to, a new kind of Heroku-inspired hosting for WSGI-compatible framework (like Django, Flask etc). And since I really can't get easy_install to work properly with my current host I decided to give a chance.

Deploying to is quite easy, if you are running linux/mac that is, when under Windows it's a whole different task (something I will come back to). One of the first thing I noticed was that you have to have all the stuff commited to a git-repo, and since I'm using a github-repo this was no biggie, but, there are some things you don't want to commit to your public git-repo, like API-keys etc. A common solution for Django is to have a file called that is never checked in (and added to your .gitignore) so you add your secret stuff for everyplace you deploy your code. And don't have a solution for this problem. I asked a question and got some good answers, but all a bit overkill for me. So this is how I solved it.


  • A folder that is added to .gitignore
  • The folder (called deploy for me) contains a deploy-script, and two folders, on called input and one called output.
  • The input-folder contains all the secret files
  • The output-folder is there as build-folder

Simple workflow

  1. Commit and push your code
  2. Run deploy\deploy.bat (yeah, I'm on Windows)

What the deploy-script does

  1. Empties the output-folder
  2. Clones the git-repo
  3. Copies the files from input to the output-folder
  4. Runs some git-commands to add and commit
  5. Adds as remote
  6. Pushes to

If you want my deploy-script please download it, and if you got any suggestions, please leave a comment=)

blog comments powered by Disqus

Copyright © 2012 Me. All rights reserved.