added main_url template
added foreign key support
fixed template bugs
added README and setup.py