All Projects → valentinogagliardi → Django Rest React Pycon

valentinogagliardi / Django Rest React Pycon

Licence: mit
🐍 Demo repo for Pycon X talk "Decoupling Django with Django REST (and a sprinkle of React)"

Programming Languages

javascript
184084 projects - #8 most used programming language
python3
1442 projects
es6
455 projects

Projects that are alternatives of or similar to Django Rest React Pycon

Crud App Vuejs Django
This is simple crud app and searchFilter made using vuejs and django. Used to explain the tutorial present on https://medium.com/@shubhambansal_89125/crud-app-using-vue-js-and-django-516edf4e4217 https://medium.com/@shubhambansal_89125/searchfilter-using-django-and-vue-js-215af82e12cd
Stars: ✭ 174 (+141.67%)
Mutual labels:  heroku, django, django-rest-framework
Generator Django Rest
Yeoman generator for a Django REST/GraphQL API, an optional React SPA & lots more!
Stars: ✭ 77 (+6.94%)
Mutual labels:  heroku, django, django-rest-framework
Ponee
A lightweight Django template ready for Heroku
Stars: ✭ 41 (-43.06%)
Mutual labels:  heroku, django, django-rest-framework
Project Dashboard With Django
Agile Project Management dashboard with Django REST and Vue.js
Stars: ✭ 25 (-65.28%)
Mutual labels:  heroku, django, django-rest-framework
Django Rest Pandas
📊📈 Serves up Pandas dataframes via the Django REST Framework for use in client-side (i.e. d3.js) visualizations and offline analysis (e.g. Excel)
Stars: ✭ 1,030 (+1330.56%)
Mutual labels:  django, django-rest-framework
Server
Django server for Travel Mate (Project: nomad)
Stars: ✭ 36 (-50%)
Mutual labels:  django, django-rest-framework
Metaci
Lightweight, Salesforce specific CI app run on Heroku to build Github repositories configured for CumulusCI
Stars: ✭ 45 (-37.5%)
Mutual labels:  heroku, django
Django Channels React Multiplayer
turn based strategy game using django channels, redux, and react hooks
Stars: ✭ 52 (-27.78%)
Mutual labels:  django, django-rest-framework
Lunch With Channels
Stars: ✭ 32 (-55.56%)
Mutual labels:  heroku, django
Drf Recaptcha
Django REST framework reCAPTCHA
Stars: ✭ 47 (-34.72%)
Mutual labels:  django, django-rest-framework
Django Rest Framework Tricks
Collection of various tricks for Django REST framework.
Stars: ✭ 52 (-27.78%)
Mutual labels:  django, django-rest-framework
Algo Phantoms Backend
💻 Algo-Phantoms-Backend is an Application that provides pathways and quizzes along with a code editor to help you towards your DSA journey.📰🔥 This repository contains the REST APIs of the application.✨
Stars: ✭ 36 (-50%)
Mutual labels:  django, django-rest-framework
Postgraduation
University management platform dedicated for post-graduation in computer science field using django rest framework.
Stars: ✭ 35 (-51.39%)
Mutual labels:  django, django-rest-framework
Djangorestframework Mvt
Serve Mapbox Vector Tiles with Django and Postgres
Stars: ✭ 33 (-54.17%)
Mutual labels:  django, django-rest-framework
Django Vue Template
Django Rest + Vue JS Template
Stars: ✭ 1,155 (+1504.17%)
Mutual labels:  django, django-rest-framework
Guides
Guides for learning + doing better web and app development. Created by Coding for Entrepreneurs.
Stars: ✭ 1,042 (+1347.22%)
Mutual labels:  heroku, django
Django React
This a simple Django and React demo application
Stars: ✭ 63 (-12.5%)
Mutual labels:  django, django-rest-framework
Django Crm
A Simple Django CRM (Customer Relationship Management) RESTful API Project
Stars: ✭ 63 (-12.5%)
Mutual labels:  django, django-rest-framework
Thinkdiff
My open source project links, programming and software development related code and tutorials are in this repo. Content types: Python, JavaScript, Dart | Django, React, Flutter, React-Native etc.
Stars: ✭ 65 (-9.72%)
Mutual labels:  django, django-rest-framework
Book Code
《Django开发从入门到实战》书籍各章节源代码
Stars: ✭ 28 (-61.11%)
Mutual labels:  django, django-rest-framework

django-rest-react-pycon

Demo repo for Pycon X talk "Decoupling Django with Django REST (and a sprinkle of React)"

Twitter: gagliardi_vale

Book in progress!

Stay tuned on my upcoming book for Apress "Decoupled Django". Understand and build decoupled Django architectures for JavaScript frontends. Follow on Twitter and Telegram for news and sneak peaks.

Intro

The following repo should be intended as a loose guideline for structuring your Django REST project with React. It is an evolution of django-drf-react-quickstart. The companion article Django REST with React (Django 2.0 and a sprinkle of testing) gave me the idea for proposing a talk at Pycon X Florence 2019.

For the integration with Vue, and more advanced topics, follow on Twitter and Telegram for news and sneak peaks about the "Decoupled Django" book.

What's inside

This repo wants to give you two ideas for organizing a Django REST project with React. The same concepts apply to Vue. The project has two apps:

  1. create-react-app_1 is a Django application containing a front-end made with create-react-app. It is a stand-alone front-end meant to be used as a single page application. The application consumes a Django REST API and uses JWT authentication. With this approach you get the best of both worlds. I did not create any model for this app, it gets the data from the API exposed by custom_webpack_conf_2/urls.py.

  2. custom_webpack_conf_2 is a Django app containing an example of a custom webpack configuration. This app exposes a REST API. It's just one of the approaches for producing a bundle into a custom location (usually app_name/static/js). The application consumes a Django REST API and uses JWT authentication. The custom webpack approach does not scale well and you'll get soon in trouble when you'll want to reach for code splitting. It works fine for smaller projects though. This project uses Redux. Demo on Heroku.

Development

Install the dependencies:

pip install -r requirements/dev.txt

Run the project:

export DJANGO_SETTINGS_MODULE="django_rest_react.settings.dev"; export SECRET_KEY='CHANGEME!' 
python manage.py runserver

Test

For UI testing see ./custom_webpack_conf_2/src/README.md

Coverage

export DJANGO_SETTINGS_MODULE="django_rest_react.settings.dev"; export SECRET_KEY='CHANGEME!' 
coverage run --source='custom_webpack_conf_2' manage.py test
coverage report
coverage html

Deploy on Heroku

git push heroku master

Abstract of the talk

With the rise of JavaScript as the lingua-franca of the web and the steady growth of libraries like React, today’s web developers can build rich and well structured frontend experiences. Pair that with Django and Django REST framework and you get the perfect combination. But it’s not all bells and whistles. What challenges are we going to face when decoupling Django with Django REST? What are the best practices? How to structure such a project? In this talk I’ll guide Django developers (both beginners and intermediate) from 0 to structuring a decoupled Django project.

Description

The goal of this talk is to give Django developers an overview of a Django REST project, paired with React, as well as the trade-offs of the decoupled approach. By the end of the talk the developer should be able to configure a new Django REST project and use a frontend library for interacting with the API.

1. Why and when to decouple Django

There are many ways for decoupling a Django application and each one depends on the use case. In this section we’ll outline what decoupling is, why decoupling is a great approach and why sometimes it is not the right thing to do. We’ll see what the challenges of such approach are and how to deal with authentication in a decoupled context.

2. Django REST fundamentals

Django REST framework is a Django application for exposing API endpoints from a Django project. It this section we’ll see the building blocks of a Django API app: the model, the serializer and the view. Models should not be a surprise for the audience, they come from Django. Serializers instead are provided by Django REST. We’ll also see how a Django REST view looks like and how to leverage both function based views and generic views within the project.

3. Setting up the frontend

The key for a truly decoupled experience is a frontend for consuming and interacting with the API. In this section we’ll see how to structure a Django REST project alongside with React. We will explore two approaches: fully decoupled frontend and mixed frontend.

4. A note on testing and closing words

In the context of a decoupled Django site we move from the typical Django tests to testing the API’s response instead. We will see how a simple API test looks like. And for the JavaScript frontend we’ll take a look at the current available tooling for functional testing.

Questions?

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].