Python - Django Integration

Find out how to integrate JSQL with Django

Stack requirements

The JSQL Django library will not work without an account in the JSQL cloud and a backend Django application written in Python. To learn more see overview.

Your backend application should have property configured database connection.

Installation

Install JSQL Django plugin to your project.

pip install jsql-django

Integration

Include JSQL Django plugin views to your `urls.py` file

Import views

from jsql.view import SelectView, InsertView, UpdateView, DeleteView

Now we have to describe the urls

url('select', SelectView.as_view()) 
url('insert', InsertView.as_view())
url('update', UpdateView.as_view())
url('delete', DeleteView.as_view())

Last thing you have to do is including ApiKey and MemberKey to your `settings.py` file.

API_KEY='YOUR_API_KEY'
MEMBER_KEY='YOUR_MEMBER_KEY'

Usage

If your application is integrated using the JSQL plugin, you can start it and try to call the query using CURL:

curl 'http://localhost:8000/select' -H 'Accept: application/json' -H 'Content-Type: application/json' 
--data-binary '{"token":"select * from person","params":{}}' --compressed

What next?

Close Menu