The Complete Pinax Setup and Deployment Guide for Dummies

Blog5 - The Complete Pinax Setup and Deployment Guide for Dummies

If you are building your website using Pinax, and you want to know how to deploy the data, look no further. We’ve compiled this handy guide on how to do just that!

Here is a very simple introduction to setting up Pinax and how to deploy using it.

Setup

Get the code you need for setup, it should look something like this:

svn checkout http://svn.pinaxproject.com/pinax/trunk/ pinax

Pinax has a dependency on the Python Imaging Library – which is not a problem to you at all, especially if you are already familiar with Python.

Next, get to know and copy the directory structure. It looks a little something like this:

pinax/                          this contains a Django project and templates
external_apps/            external re-usable apps brought in via svn:externals
local_apps/                  re-usable apps that aren’t yet externalized
core_apps/                  non-re-usable apps that are pinax – specific
external_libs/               this is external libraries

The manage.py script of pinax links apps up correctly, so you don’t have to worry about it at all. Now, all that is left to do is navigate over to pinax/ and let the ./manage.py syncdb. run.

Then, you need to run ./manage.py runserver.

If you have followed these steps, you should be on the welcome page.

Deploying to Heroku with Pinax

Now, if you have completed your work and you want to deploy, simply follow these easy steps:

Create the Heroku app with this code:

heroku create

Next, you need to set the buildpack for the site to use Python:

heroku buildpacks:set git://github.com/heroku/heroku-buildpack-python.git

You have to set up the buildpack for the detection ordering – Pinax includes a package.json file that tricks Heroku to see your project as a Node.js app. It has to be identified as a Python app.

Now you have to set up your project

Go to your project and add the text below to your requirements.txt:

django-toolbelt

Add a file to your project, name it Procfile and add the content below:

web: gunicorn –log-file – mysite.wsgi

Go to your settings.py and change the following:

DATABASES = {
“default”: {
“ENGINE”: “django.db.backends.sqlite3”,
“NAME”: “dev.db”,
}
}

to:

import dj_database_url
DATABASES = {
“default”: dj_database_url.config()
}

img4 - The Complete Pinax Setup and Deployment Guide for Dummies

Go to your mysite/wsgi.py and change:

application = get_wsgi_application()

to:

from dj_static import Cling, MediaCling
application = Cling(MediaCling(get_wsgi_application()))

Now you have to commit to git

Add everything you need to deploy and commit:

git add .
git commit -m “added Heroku support”

Still following? Good. Now you are ready to deploy to Heroku!

You need to use git in order to deploy to Heroku:

git push heroku master

The last and final step is running migrations:

heroku run python manage.py migrate

And that is a wrap, ladies, and gentlemen! We hope you have found this step-by-step guide helpful. Remember that we write about all things web development and design, so keep an eye out for other related articles if you have found this particular one of help. If you would like to add some of your skills to our blog, be sure to contact us and submit some of your own work!

For more Pinax related content, be sure to visit their handy documentation site where you will find more helpful how-to guides.

Related posts

Leave a Comment