I've been traveling over the past few weekends. One of the things that I always try to do before getting on the plane is download the sphinx docs of any projects I might be working with. One thing that I love about the static html sphinx build is that it includes a search feature. However, that search feature only works when running the docs from an http server. If you try and use search when opening the files directly, you will get an error that looks something like this
Origin null is not allowed by Access-Control-Allow-Origin.
A quick fix is to use the builtin http server that comes from python. It serves local files from whatever directory it is launched in. So go into the html folder of your docs build and run
python -m SimpleHTTPServer 8000. After that you should be able to see the docs by going to http://127.0.0.1:8000.
One caveat is that you have to change the port for each set of docs you might want to run at a given time.
Today I learned something new about custom headers, django and nginx.
We have an endpoint in our django app that uses custom headers to validate a request, ala Amazon AWS requests. Basically, the client creates a hash and sets a header with the value. Then on the server side, we validate that the hash is valid and continue on.
In development, everything was hunky dory. However, once we started testing in our staging environment, the headers were never getting to our django app. The only difference between the environments was the addition of nginx. After much hair pulling and grousing, we came upon this interesting configuration bit underscores_in_headers. It turns out that nginx will strip any headers it recieves that contain underscores, unless this flag is turned on.
Moral of the story, don't use headers with underscores or turn on the flag in nginx.
I recently switched the theme here in order to inspire myself to write more content. The only thing I was having issue with was getting code blocks to work correctly.
Below is a sample from the markdown reference:
require 'redcarpet' markdown = Redcarpet.new("Hello World!") puts markdown.to_html
Some python thrown in to see what it looks like
import stuff s = "Python syntax highlighting" print s
Instead of resolutions, I try to set some personal goals each year. Some years it works,
some years it doesn't. Last year I had 2 primary goals and I feel like I achieved each.
The first was to end the year weighing under 200 pounds for the first time since high school. I'm happy to report that as of yesterday morning I weight 184 lbs, so unless I somehow consumed a significant
amount of food while sleeping last night I met that goal. My second goal was to help organize
a local conference. It wasn't quite a conference, but I did help run the Nashville Hack Day, a
one day event where developers came together to hangout and share ideas.
I recently had some people ask questions about installing django
curl -O http://python-distribute.org/distribute_setup.py sudo python distribute_setup.py (optional) - you can remove distribute_setup.py
sudo easy_install pip
sudo pip install virtualenv
mkdir -p ~/envs cd ~/envs virtualenv --no-site-packages --distribute django-env source ~/envs/django-env/bin/activate
pip install django
create new django project
cd ~/ django-admin.py start project newproj