Code Monkey home page Code Monkey logo

django-graphql-project-template's Introduction

Project Overview

This project is a template project to scaffold or create the initial structure of your project using django, graphene-django, djangorestframework and django-filter. This project is helps you to build a graphql API OpenCRUD compliance.`

To read more about OpenCRUD please go to: https://www.opencrud.org/

PROJECT STRUCTURE

File Name Description
├── config/ This folder contains the source files for the config.
├── requirements/ This folder contains the source files for the requirements.
.gitignore Git ignore config file
manage.py
requirements.develop Requirement file for development mode.
requirements.production Requirement file for production mode.
requirements.staging Requirement file for staging mode.
requirements.testing Requirement file for testing mode.
run.py Entrypoint for production mode.
tox.ini Config file for linting, testing, coverage and ohter things.

Pre-requisites

Creating a new project

If you are using Windows, use git bash to run these commands.

Creating the project folder

mkdir awesome-graphql-api && cd awesome-graphql-api

Creating the virtual environment

python -m venv venv

Activating the virtual environment

source venv/bin/activate

For Windows only

. venv/Scripts/activate

Deactivating the virtual environment

deactivate

Updating pip and installing pip-tools

python -m pip install --upgrade pip && pip install pip-tools

Compiling the requirement file

For development

pip-compile -r requirements/develop.in -o requirements.develop

For production

pip-compile -r requirements/production.in -o requirements.production

For staging

pip-compile -r requirements/staging.in -o requirements.staging

For testing

pip-compile -r requirements/testing.in -o requirements.testing

Installing the dependencies

For development

pip install -r requirements.develop

For production

pip install -r requirements.production

For staging

pip install -r requirements.staging

For testing

pip install -r requirements.testing

Scaffolding a project

django-admin startproject --template https://github.com/danilobrinu/django-graphql-project-template/archive/master.zip <awesome-project> .

Example: django-admin startproject --template https://github.com/danilobrinu/django-graphql-project-template/archive/master.zip my-graphql-api

Scaffolding an app

django-admin startapp --template https://github.com/danilobrinu/django-graphql-app-template/archive/master.zip <awesome-app>

Example: python manage.py --template https://github.com/danilobrinu/django-graphql-app-template/archive/master.zip api_v1

Note: to read more about scaffoling an app, please go to: https://github.com/danilobrinu/django-graphql-app-template

Scaffoling a domain app

To scaffold a domain app you need to go to inside of the domain folder part of an app. Only run this this command inside of the your <awesome-app>/domain folder. For instance: api_v1/domain

django-admin startapp --template https://github.com/danilobrinu/django-graphql-app-domain-template/archive/master.zip <awesome-app-domain>

Example: django-admin startapp --template https://github.com/danilobrinu/django-graphql-app-domain-template/archive/master.zip post

Note: to read more about scaffolding a domain app, please go to: https://github.com/danilobrinu/django-graphql-domain-app-template.

Running an app

For development

python manage.py runserver

For production

python run.py

Verifying

Endpoint URL: http://<domain>/<path-to-your-graphql-endpoint>

For development: The domain is localhost:8000 and the path to your graphql is graphql/v1.

Open the GraphQL Playground with http://localhost:8000/graphql/v1

For production: The domain is awesome.graphql.io and the path to your graphql is graphql/v1.

Open the GraphQL Playground with http:///awesome.graphql.io/graphql/v1

Note: change awesome.graphql.io to your endpoint for production.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.