GalsenApi is an API that allows you to easily manipulate data on Senegal. A project inspired by the package. Galsenify
- Create a virtual environment:
python -m venv .venv
- Activate the virtual environment:
source .venv/bin/activate
- Install the dependencies:
pip install requirements.txt
- Run the migrations:
python manage.py makemigrations
python manage.py migrate
- Create a super user:
python manage.py createsuperuser
- Create a .env file in the Django project to store the secret key.
GET /api/regions/
GET /api/regions/1/
GET /api/departements
GET /api/departements/1/
GET api/villages
GET /api/villages/1
GET /api/pays/
Created by Lassana SIBY
Thank you to Daouda BA for the data..
Views for regions and departments.
def regions_view(request):
query = request.GET.get('q')
url = 'https://galsenapi.vercel.app/api/regions/'
params = {'search': query} if query else {}
response = requests.get(url, params=params)
data = response.json()
regions = data
context = {'regions': regions, 'query': query}
return render(request, 'demo/regions.html', context)
def departments_view(request):
query = request.GET.get('q')
url = 'https://galsenapi.vercel.app/api/departements/'
params = {'search': query} if query else {}
response = requests.get(url, params=params)
data = response.json()
departments = data
context = {'departments': departments, 'query': query}
return render(request, 'demo/departements.html', context)
def villages_view(request):
query = request.GET.get('q')
url = 'https://galsenapi.vercel.app/api/villages/'
params = {'search': query} if query else {}
response = requests.get(url, params=params)
data = response.json()
villages = data
context = {'villages': villages, 'query': query}
return render(request, 'demo/village.html', context)