Skip to content

Instantly share code, notes, and snippets.

@andreif
Created August 24, 2011 10:22
Show Gist options
  • Save andreif/1167735 to your computer and use it in GitHub Desktop.
Save andreif/1167735 to your computer and use it in GitHub Desktop.
Initial Django site setup to run on Heroku (work in progress)

1. Installing prerequisites (Mac OS X)

https://gist.github.com/1341606

2. Creating a Django site

2.1. Install Django

pip install Django

2.2. Create a fresh Django site

mkdir ~/django-heroku
cd ~/django-heroku
django-admin.py startproject mysite
cd mysite
python manage.py runserver

2.3. Set up database and directories in the settings

  • Keep the root dir in a variable

  • Set sqlite3 as db driver and provide the path to db file

  • Set media root path

  • Set templates path

    python manage.py syncdb

2.4. Setup DMSL

STATIC_DEPS=true pip install lxml
pip install cython

mkdir ~/django-heroku/vendor
git clone git://github.com/dasacc22/dmsl.git ~/django-heroku/vendor/dmsl
cd ~/django-heroku/vendor/dmsl
sudo python setup.py install --record ../dmsl-install-files.txt

Then add DMSL settings

2.4. Add a core app to the site

python manage.py startapp core

2.5. Add a simple page

  • Create templates for layout and page
  • Add a view function

2.6. HamlPy templates

pip install hamlpy
pip install djaml

Add template loader.

Then create templates/index.haml

3. Installing SASS and CoffeeScript

3.1. Sass and Compass

gem install sass
gem install compass
mkdir ~/django-heroku/mysite/media
cd ~/django-heroku/mysite/media
compass create compass [--using blueprint]
cd compass
compass watch

3.2. Less

npm install -g less
npm install -g coffee-script
pip install django-compressor

In order to work with HamlPy

pip install BeautifulSoup

Add settings http://django_compressor.readthedocs.org/en/latest/installation/ http://django_compressor.readthedocs.org/en/latest/settings/#compress-precompilers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment