Skip to content

Commit 811443d

Browse files
author
Ram Idavalapati
authored
Merge pull request #2 from RamanjaneyuluIdavalapati/master
README improved
2 parents 2fb9b5c + a2d4734 commit 811443d

File tree

3 files changed

+44
-23
lines changed

3 files changed

+44
-23
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ script:
77
- echo "No tests as of now"
88
deploy:
99
- provider: releases
10+
skip_cleanup: true
1011
api_key:
1112
secure: szU2C7KG3GzWO6x5RleHRf+/OpKvZWpN9Z+JPYb0xr+oSCQfms5/kMG8tTBUxjm5exv6xRsnknAa0vL+DqyeNEo8bPBYt3ZoDbB9pTqZhYuKSqDQnAP9N7xrmaXK7AVtuY07zDVToI6M0pWaqn+7A5YG0c9lqt3EuaCbSosqShzoDEZvO9bY1q4tsmjrP7hC28phsOuXCRzBBSabXEueyNeJInDTVFjfxp+yD1du3zIC1Qy4hi1rurTROSogKVWaChVcR9JJdAdawG/5J4QULtuma8fBvo2GhrJSH6ofTsLI1LXo64IixXqhb+FoAbABMjDkukjOXfOgiovGeay5n1PFuenFvQY3T3OscGJId16HeQPJ8BPd6U1k0b57Ij9Fl2nraUSIVpoC3tpBfyhMfXyF08ZEfXIJJwQl1BU96EZXt7PpgY7Mh9MwUnKh6SZ6E9ykwp1jVQ+YSS47u5nWpdAr6DYkjrCfwxw9hOWqH1tgyiSNw1u0xpA7qWUAl8JrEQrrq1EG9buGrH3aeF0p4eyTg38IdqQGhXNWLVJzo4U+QdVT930hDE6CCwhvc5otFiBKqED3ZAidAOJOq4ECZLPOGc8YIvd/4LXZTsaZEfQ1ovAqJnxTOvS5TnarAGI4CO8OvyqTN3nRdzrcMcYkdK5xyoG/jqHPD2jB3H/5Sls=
1213
file:
@@ -16,8 +17,8 @@ deploy:
1617
- kwikapi/__init__.py
1718
- kwikapi/django/__init__.py
1819
- kwikapi/django/kwikapi_django.py
19-
name: kwikapi.django-0.0.1
20-
tag_name: 0.0.1
20+
name: kwikapi.django-0.1
21+
tag_name: 0.1
2122
on:
2223
repo: deep-compute/kwikapi.django
2324
- provider: pypi

README.md

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
# Use kwikapi in Django
1+
# kwikapi.django
2+
3+
Quickly build API services to expose functionality in Python. `kwikapi.django` was built by using the functionality of KwikAPI and Django web server.
4+
5+
## Installation
26

3-
## Install kwikapi for Django
47
```bash
58
$ pip install kwikapi[django]
69
```
710

8-
## Create a Django project (Ref: https://docs.djangoproject.com/en/1.9/intro/tutorial01/)
11+
## Usage
12+
13+
### Create a Django project
14+
15+
(Ref: https://docs.djangoproject.com/en/1.9/intro/tutorial01/)
16+
917
```bash
1018
$ django-admin startproject django_kwikapi
1119
```
1220

13-
## Create an app in Django
21+
### Create an app in Django
22+
1423
```bash
1524
$ python manage.py startapp polls
16-
``
25+
```
26+
27+
### Add your app name to settings.py
1728

18-
#### Add your app name to settings.py
1929
```python
2030
INSTALLED_APPS = [
2131
'django.contrib.admin',
@@ -27,7 +37,10 @@ INSTALLED_APPS = [
2737
'polls',
2838
]
2939
```
30-
## /django_kwikapi/django_kwikapi/urls.py
40+
### Make sure the contents of files be like this
41+
42+
/django_kwikapi/django_kwikapi/urls.py
43+
3144
```python
3245
from django.conf.urls import url, include
3346
from django.contrib import admin
@@ -38,52 +51,59 @@ urlpatterns = [
3851
]
3952
```
4053

41-
## /django_kwikapi/polls/urls.py
54+
/django_kwikapi/polls/urls.py
55+
4256
```python
4357
from django.conf.urls import url, include
4458

4559
from . import views
46-
from kwikapi.django import RequestHandler
60+
from kwikapi_django import RequestHandler
4761

4862
urlpatterns = [
4963
url(r'api/', RequestHandler(views.api).handle_request),
5064
]
5165
```
5266

53-
## /django_kwikapi/polls/views.py
67+
### Example of django views
68+
69+
/django_kwikapi/polls/views.py
70+
5471
```python
5572
from django.http import HttpResponse
5673
from kwikapi import API
5774
from logging import Logger
5875

5976
class BaseCalc():
60-
def add(self, a: int, b: int) -> int:
77+
def add(self, request, a: int, b: int):
6178
return a + b
6279

63-
def subtract(self, a: int, b: int) -> int:
80+
def subtract(self, request, a: int, b: int):
6481
return a - b
6582

6683
class StandardCalc():
67-
def multiply(self, a: int, b: int) -> int:
84+
def multiply(self, request, a: int, b: int):
6885
return a * b
6986

70-
def divide(self, a: int, b: int) -> int:
87+
def divide(self, request, a: int, b: int):
7188
return a / b
7289

7390
api = API(Logger, default_version='v1')
7491
api.register(BaseCalc(), 'v1')
7592
api.register(StandardCalc(), "v2")
7693
```
7794

78-
## Start Django
95+
### Start Django
96+
7997
```bash
8098
$ python manage.py makemigrations
8199
$ python manage.py migrate
82100
$ python manage.py runserver 8888
83101
```
84102

85-
## Make API request
103+
### Make API request
104+
86105
```bash
87-
$ curl http://localhost:8888/api/v1/add?a=10&b=10
88-
$ curl http://localhost:8888/api/v2/divide?a=10&b=10
106+
$ curl "http://localhost:8888/api/v1/add?a=10&b=10"
89107
```
108+
109+
> To know how to use all features, please refer KwikAPI documentation https://github.com/deep-compute/kwikapi/blob/master/README.md

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from setuptools import setup, find_packages
22

3-
version = '0.0.1'
3+
version = '0.1'
44
setup(
5-
name="kwikapi_django",
5+
name="kwikapi-django",
66
version=version,
77
packages=find_packages("."),
88
package_dir={'kwikapi_django': 'django'},
@@ -14,7 +14,7 @@
1414
author='Deep Compute, LLC',
1515
author_email='[email protected]',
1616
install_requires=[
17-
'django==1.9',
17+
'django==1.11',
1818
],
1919
classifiers=[
2020
'Environment :: Web Environment',

0 commit comments

Comments
 (0)