Skip to content

sirb0rab0g1/DRF-Docker-PipEnv-Nginx-Daphne-Redis-JWT-GraphQL

Repository files navigation

Drf-Docker-PipEnv-Nginx-Daphne-Redis

Prerequisites

  1. Must have Docker installed.

Pre-setup

  1. Change/duplicate .env.tpl to .env and edit the values inside accordingly

1. First to install pipenv version 18.0

make fix

2. For building local development

make local

To stop and remove the dockerize environment

make down

To makemigrations

make migrations name= then the name you want to commit

How to

After building your local development you must create a superuser account

make superuser required because of JWT authentication

Then login in django admin

http://localhost:8000/api/admin/

After a successful login navigate to

http://localhost:8000/api/basic/information/

To test a graphql by graphqil interface navigate to

http://localhost:8000/api/basic/graphiql

EXTRAS

To run a editor inside docker container using bpython

make editor

FEATURES!!

deployment of applications inside software containers

Browsable api

For installing dependencies

As proxy

As the interface server

Handling connections and sockets asynchronously

As the backend

This django application eliminates certain annoyances in the Django framework.

Unlike some more typical uses of JWTs, this module only generates authentication tokens that will verify the user who is requesting one of your DRF protected API resources.

Primary focus here is to give a good understanding of how to connect models from Django ORM to graphene object types.

FAQ

  • TypeError: 'module' object is not callable This is cause by django 3.7 and pipenv 18.1 version. So to fix this

    • pip install pipenv
    • pipenv run pip install pip==18.0
    • pipenv install

    or just type

    • make fix
  • I'm getting ERROR: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io ... : read: connection refused error.

    • Do docker-machine ssh default, then edit the resolve file sudo vi /etc/resolv.conf change the nameserver value to 1.1.1.1 or 8.8.8.8
  • : Bind for 0.0.0.0:5432 failed: port is already allocated

    • docker ps

    • after that this will showen up
      13b484047582 postgres:9.6.5-alpine "docker-entrypoint.s…" 28 hours ago Up 5 hours 0.0.0.0:5432->5432/tcp sample_db

    • the conflict is 0.0.0.0:5432->5432/tcp

    • we need to stop the docker container first

    • $ docker stop 13b484047582

    • then remove

    • $ docker remove 13b484047582

    • then re run the environment

    • $ make local(rebuilding container) / make up(starting container)

About

To make it short, django-docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •