Restructure the URLs

Moved API views/urls to a separate `api.py` file.

Also added small Django/PEP8 conventions fixes in templates.