Skip to content

Installing Hyde on Mac OS X using MacPorts

colby edited this page Sep 13, 2010 · 9 revisions

You can do almost everything via MacPorts and the command line.

If you get any MacPorts errors about one or more modules already being installed, try sudo port upgrade <module> to see if there is a newer version. You are also free to use the 2.6 version as well. These commands will also install any dependancies (notably another instance of python2.5 in the /opt directory)

sudo port selfupdate
sudo port install py25-django 
sudo port install py25-yaml
sudo port install py25-markdown
sudo port install py25-pygments

We are assuming you want to install Hyde in your home directory (~). This may not be the case for you.

mkdir ~/HydeProject
cd ~/HydeProject

As of this writing, YUI compressor can be found at the address below. If this DL fails, try http://developer.yahoo.com/yui/compressor/ for the latest version.

curl -O http://www.julienlecomte.net/yuicompressor/yuicompressor-2.4.2.zip
unzip yuicompressor-2.4.2.zip
rm yuicompressor-2.4.2.zip

You can get hyde via git or via download at Hyde project page at github.

git clone git://github.com/lakshmivyas/hyde.git

Optional but useful: An entire website example using hyde by the creator. Also found at github.

git clone git://github.com/lakshmivyas/ringce.git

Again, replace the path with where ever you want.

mkdir website_src
mkdir website_deploy

Using Hyde

Now we can finally build a site. We start by initializing our project.

cd ~/HydeProject/hyde
python hyde.py --init --template=default -s ~/HydeProject/website_src

A small interjection about MacPorts and python

Since we used MacPorts instead of setuptools, we want to use the python in the opt/local/bin directory, which may actually be called python2.5 or python2.6. Type which python to see which one you are using. You may need to use one of the following commands:

python2.5 hyde.py --init --template=default -s ~/HydeProject/website_src 
python2.6 hyde.py --init --template=default -s ~/HydeProject/website_src 

In the settings.py file , edit the SITE_ROOT variable like such:

SITE_ROOT = "file:///Users/USERNAME/HydeProject/website_deploy/"

Hyde comes with a version of YUI Compressor, but if it’s not the latest, you can modify the following line in settings.py:

YUI_COMPRESSOR = "../yuicompressor-2.4.2/build/yuicompressor-2.4.2.jar"

Generating a website with Hyde

We now have enough to build the default website. To do so, we use the —generate (or -g) flag:

python hyde.py --generate -s ~/HydeProject/website_src -d ~/HydeProject/website_deploy

If you get an error about YAML not found, it probably means you are using the wrong python. See the small interjection about and try one of the following variants:

python2.5 hyde.py --generate -s ~/HydeProject/website_src -d ~/HydeProject/website_deploy
python2.6 hyde.py --generate -s ~/HydeProject/website_src -d ~/HydeProject/website_deploy

Where to go next

First, if you are not familiar with the Django templates, the website_src will not make much sense. Pay particular attention to the extends and include keywords. These are probably the most powerful tools in the box for creating flexible templates. The documentation is available here.

Once you have some familiarity with the templating system, play around in the layout area. This is where the templates are stored, and where you will be doing most of your work. The content folder is where you put articles, posts or other content. Once you’ve set up your templates, you just add a new file, prepend with the proper blocks and variables and generate your site.

Clone this wiki locally