ldtalent / mainakamau-auth-django-graphql-sendgrid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project Title

Confirming emails on your Django/GraphQL API using SendGrid

Project Overview

This repository contains an authentication system, albeit rudimentary that executes email dissemination upon registration. Email to confirm ownership of emails used for registration.

Prerequisites

For the web application to run locally a few requirements are necessary:

  • Python 3 or newer
  • Django
  • Graphene Django
  • Pipenv
  • All the listed dependencies in the requirements.txt file
  • Git

    NB: All the commands in the README.md on setup and running assume a unix based environment

Getting Started

  1. Run the following command from your git command line tool

    • git clone https://github.com/learningdollars/mainakamau-auth-django-graphql-sendgrid.git

    The command clones a local copy of the project folder to your local machine

  2. Navigate into the folder that has been created and create a virtual environment and activate the virtual environment by running:

    • pipenv shell
  1. Run the migrations command to setup the database tables after installing the requirements in the requirements.txt
    • python manage.py makemigrations (this command should create a migrations folder)
    • python manage.py migrate
  1. Run the python manage.py runserver command to start the application(it should ideally be served on your local address(127.0.0.1:8000) on port 8000)

  2. You should get this response on running the application

    Performing system checks...
    
    System check identified no issues (0 silenced).
    March 19, 2019 - 06:52:52
    Django version 2.1.7, using settings 'django_rest_api.settings'
    Starting development server at http://127.0.0.1:8000/
    Quit the server with CONTROL-C.
    
  3. The single endpoint generated by GraphQL -> http://127.0.0.1:8000/sendgriddemo/

  4. Use below mutation after navigating to http://127.0.0.1:8000/sendgriddemo/ to register a new user with a valid email address

mutation {
          createUser(username:"{username}" email: "{email}", password: "{password}"){
            user {
              email
            }
            message
          }
        }
  1. Check you email and click on the verify button to verify the email.
  2. Proceed to execute below mutation for successful login
mutation {
          loginUser(email: "{email}", password: "{password}"){
            message
            token
          }
        }
  1. To run available tests use: python manage.py test

About


Languages

Language:Python 91.9%Language:HTML 8.1%