Skip to content

Latest commit

 

History

History
112 lines (85 loc) · 3.8 KB

README.md

File metadata and controls

112 lines (85 loc) · 3.8 KB

Build Status Python 3.7 Docker Stars Docker Pulls Docker Automated Docker Build Gitter chat

Django Restful API template

Django Restful API backend template - project generator/development environment. Can be used by Python developers for quick start on building Restful API's using Django framework and django-rest-framework. This project is aimed to simmplify development environment setup and includes many useful dev tools like RabbitMQ, Redis, Elasticsearch, Kibana, Apidoc

Stack includes

  • RabbitMQ
  • Redis
  • Elasticsearch
  • Logstash
  • PostgreSQL
  • Nginx
  • Supervisord
  • Kibana
  • Apidoc

Python libraries included:

  • django-rest-framework
  • uwsgi
  • psycopg2

Installation

  1. Clone this project into your work directory:
$ git clone "https://github.com/trydirect/django-restful.git"
  1. Bring up services with docker-compose:
$ cd django-restful/v01/dockerfiles
$ docker-compose up -d
$ docker-compose exec web python manage.py migrate
  1. Now, let's check it out
$ curl -i localhost/users/
HTTP/1.1 200 OK
Server: nginx/1.16.0
Date: Thu, 13 Jun 2019 10:39:46 GMT
Content-Type: application/json
Content-Length: 52
Connection: keep-alive
Vary: Accept, Cookie
Allow: GET, POST, HEAD, OPTIONS
X-Frame-Options: SAMEORIGIN

{"count":0,"next":null,"previous":null,"results":[]}
  1. Let's check running containers
$ docker-compose ps
Name                  Command                          State          Ports
------------------------------------------------------------------------------------------------------------------------------
db                    docker-entrypoint.sh postgres    Up (healthy)   5432/tcp
elasticsearch         /docker-entrypoint.sh elas ...   Up             9200/tcp, 9300/tcp
kibana                /docker-entrypoint.sh kibana     Up             0.0.0.0:5601->5601/tcp
logstash              /docker-entrypoint.sh -e         Up             0.0.0.0:5044->5044/tcp
mq                    docker-entrypoint.sh rabbi ...   Up (healthy)   15671/tcp, 0.0.0.0:21072->15672/tcp, 25672/tcp, 4369/tcp, 5671/tcp, 0.0.0.0:2172->5672/tcp,0.0.0.0:32770->5672/tcp
nginx                 /usr/bin/supervisord -c /e ...   Up             0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
redis                 docker-entrypoint.sh redis ...   Up (healthy)   6379/tcp
web                   /usr/bin/supervisord -c /e ...   Up             0.0.0.0:8000->8000/tcp   
  1. Run tests
$ python ../../tests.py

Generate Api Doc

$ sh ./djangorest/scripts/apidoc.sh

Quick deployment to cloud

Amazon AWS, Digital Ocean, Hetzner and others

Contributing

  1. Fork it (https://github.com/trydirect/django-restful/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Support Development

Donate