This repository contains the code for the Sarpanch API hosted at: api.sarpanch.org and the
promotional website is hosted at sarpanch.org. The API is built using the Django Rest
Framework deployed on Heroku and the promo webiste is built in Vue and deployed using
Netlify.
https://documenter.getpostman.com/view/11883658/TVzNJzGo
The code for the promo website is is /landing. /landing/README.md has more information.
The dependencies are managed by Pipenv. To activate the virtual environment do the following:
pip install pipenvpipenv install --devpipenv shell
At this point you will need the .env file to get the app to run. To get this
file please contact Param at param@theorangeyak.co for further instructions. Or
if you have permission, you will be able to find all the credentials for this
project in the Orange Yak Google Drive folder. Look at:
theorangeyakco/<active_projects|archived_projects>/ sarpanch/notes/credentials.gsheet.
You will also find the environment variables there.
Now you will need other pre-requisites:
postgresSQL- Please set it up on your machine and create a local database to connect to. Put
this localhost URL in the
DATABASE_URLenvironment variable.
- Please set it up on your machine and create a local database to connect to. Put
this localhost URL in the
redis- Not currently required.
Finally, you can run the app with:
python manage.py runserver
Which will start a server at localhost:8000.
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated
from knox.auth import TokenAuthentication
class SomeView(APIView):
# ...
permission_classes = (IsAuthenticated,)
authentication_classes = (TokenAuthentication,)
# ...