Skip to content

PacktPublishing/Full-stack-Django-and-React

Repository files navigation

Full Stack Django and React

Full Stack Django and React

This is the code repository for Full Stack Django and React, published by Packt.

Get hands-on experience in full-stack web development with Python, React, and AWS

What is this book about?

Django developers often need to rely on front-end developers to build client-side solution for their web apps. By combining the capabilities of React with Django, this book creates a complete learning path to go from being a backend developer to a full stack developer in no time. This book will help you use React to build state-of-the-art UI layouts and Django to create an immaculate backend.

This book covers the following exciting features:

  • Explore how things work differently under the hood in the frontend as well as backend
  • Discover how to build an API with Django
  • Start from scratch to build an intuitive user interface using React capabilities
  • Dockerize and prepare projects for deployment
  • Deploy API and UI on various platforms like AWS and Vercel

If you feel this book is for you, get your copy

Instructions and Navigations

All of the code is organized into folders. For example, Chapter03.

The code will look like the following:

from rest_framework import viewsets
from rest_framework import filters
class AbstractViewSet(viewsets.ModelViewSet):
  filter_backends = [filters.OrderingFilter]
  ordering_fields = ['updated', 'created']
  ordering = ['-updated']

Following is what you need for this book: This book is for Django web developers who want to get started with full-stack development and learn a frontend framework that can be quickly bootstrapped with the backend to build full-stack applications. Familiarity to React and JavaScript would be an added advantage.

With the following software and hardware list you can run all code files present in the book (Chapter 1-16).

Software and Hardware List

Chapter Software/Hardware required OS required
1-16 Python Windows, Mac OS X, and Linux
1-16 JavaScript Windows, Mac OS X, and Linux
1-16 PostgreSQL Windows, Mac OS X, and Linux
1-16 Django Windows, Mac OS X, and Linux
1-16 React Windows, Mac OS X, and Linux
1-16 Docker Windows, Mac OS X, and Linux

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Issue - Initial User Migration Failed with Admin.0001 Dependency

After creating the UserManager and User models, if the migration fails with the following error:
Migration admin.0001_initial is applied before its dependency core_user.0001_initial on database 'default'.

Please try running these commands:
$ sudo su postgres
$ psql
postgres=# DROP DATABASE coredb;
postgres=# CREATE DATABASE coredb;
postgres=# ALTER ROLE core SET client_encoding TO 'utf8';
postgres=# ALTER ROLE core SET default_transaction_isolation TO 'read committed';
postgres=# ALTER ROLE core SET timezone TO 'UTC';
postgres=# ALTER DATABASE coredb OWNER TO core;
postgres=# GRANT ALL PRIVILEGES ON DATABASE coredb TO core;

If you already ran the "makemigrations" for core_user, simply run python manage.py migrate

For more details check out this thread by our reader remyluslosius.

Errata

  • Page 81 (line 19):
post = serializers.SlugRelatedField(queryset=Post.objects.all(), slug_field='public_id')

  def to_representation(self, instance):
        rep = super().to_representation(instance)
        

should be

post = serializers.SlugRelatedField(queryset=Post.objects.all(), slug_field='public_id')

        def validate_author(self, value):
          if self.context["request"].user != value:
            raise ValidationError("You can't create a post for another user.")
        return value
        
        def to_representation(self, instance):
          rep = super().to_representation(instance)

Related products

Get to Know the Author

Kolawole Mangabo is a Software Engineer, currently specializing in HTML, CSS, JavaScript, and Python while regularly using React, Vue, and Django to build single-page applications and marketing landing pages in his daily routine. His goal in a team is to always build products that provide pixel-perfect, performant experiences adjusting business and user needs. When he is not coding, he spends most of his time writing and publishing articles on various websites on topics like software architecture, testing, full-stack development, and developer experience.

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781803242972

About

Full-stack Django and React, published by Packt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published