Seedstars / django-react-redux-base

Seedstars Labs Base Django React Redux Project
MIT License
2.66k stars 341 forks source link
django react redux

Build Status

Django React/Redux Base Project

This repository includes a boilerplate project used for all Seedstars Labs applications. It uses Django as backend and React as frontend.

We build on the shoulders of giants with the following technologies:

Frontend

Backend

Readme Notes

Retrieve code

Remember that when you copy this repository for a new project you need to add the scripts external module using:

NOTE: This is only needed in case you copy this code to a new project. If you only clone or fork the repository, the submodule is already configured

Installation

You have two ways of running this project: Using the Dockers scripts or running directly in the console.

Running NO DOCKER

NodeJS tooling

Compile and run project

There are commands you need to compile javascript and run project. Ideally yarn run dev should be run in another console because it blocks it.

Then open your browser the page: http://localhost:8000/ If all goes ok you should see a React single page app.

Running DOCKER

We use Docker as a development environment. For production, we leave you to set it up the way you feel better, although it is trivial to extrapolate a production environment from the current docker-compose.yml.

To stop the development server:

Stop Docker development server and remove containers, networks, volumes, and images created by up.

You can access shell in a container

The database can be accessed @localhost:5433

Accessing Website

The project has CORS enabled and the URL is hard-coded in javascript to http://localhost:8000 For login to work you will to use this URL in your browser.

Testing

To make sure the code respects all coding guidelines you should run the statics analysis and test scripts before pushing any code.

Frontend (javascript tests)

Backend (django/python tests)

Please take into account that test_local_backend.sh runs py.test with --nomigrations --reuse-db flags to allow it be performant. Any time you add a migration please remove those flags next time you run the script.

Static analysis

Frontend (javascript static analysis)

Backend (django/python static analysis)

Deployment in Production

We deploy all our production code using Kubernetes. Explaining how to do deployments is beyond the scope of this boilerplate.

Here's a great article from digital ocean on how to deploy django project in a VM: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

Screenshots

Here are some screenshots of the boilerplate project.

Screenshot01

Screenshot02

Gotchas in Docker

Contributing

We welcome contributions from the community, given that they respect these basic guidelines:

Prior to any pull-request, we advise to open an issue. This is because, although we are happy to merge your code, we must make sure the changes don't impact our way of doing things, thus resulting on a declined PR, and your time wasted.

If you want to tackle any open issue, well..... Just go for it! :)