Skip to content

Commit

Permalink
Oppdaterte heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
oc committed Mar 21, 2012
1 parent ef8e20c commit b347395
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions slides/del3.html
Expand Up @@ -644,7 +644,7 @@ <h2>Tasks</h2>

# Deploy

Heroku! Krever Ruby 1.8.6 eller nyere installert.
Heroku! Krever Ruby 1.8.6 eller nyere installert, samt at du bruker git versjonskontroll.

Windows: RubyInstaller, Linux: aptitude/yum install ruby rubygems

Expand Down Expand Up @@ -672,22 +672,40 @@ <h2>Tasks</h2>
Det neste vi må gjøre er å sette opp applikasjonen vårt i `virtualenv`. Virtualenv er en abstraksjon (lik rvm) for å
distribuere fullstendige python-miljøer.

sudo pip install virtualenv
sudo pip install virtualenv

virtualenv heroku-env --distribute
virtualenv heroku-env --distribute
New python executable in heroku-env/bin/python
Installing distribute........done.
Installing pip...............done.

➜ source heroku-env/bin/activate
➜ pip install Django gunicorn psycopg2
➜ pip freeze > dependencies.txt
echo "heroku-env" >> .gitignore

Vi aktiverer så det nye virtuelle miljøet, og installerer nødvendige pakker:

source heroku-env/bin/activate
pip install Django gunicorn psycopg2


---

# Deploy #3

Heroku krever to filer for å fungere: `requirements.txt` for å styre avhengigheter, og `Procfile` for å styre prosesser (web og workers):

pip freeze > requirements.txt
echo -e 'web: python del3/manage.py run_gunicorn -b "0.0.0.0:$PORT" -w 3' > Procfile

Som du ser over, bruker vi gunicorn som webserver, vi må derfor også legge denne til i settings.py under `INSTALLED_APPS` som: `'gunicorn'`.

Da kan vi pushe:

git commit -am "Ready for heroku\!"

git push heroku master

Sett opp database:

heroku run python del3/manage.py syncdb

---

Expand Down

0 comments on commit b347395

Please sign in to comment.