Skip to main content

Django Reactify

Django Reactify is an app that allows developers to add and use React components in your Django app without using create-react-app.

Quick start

  1. Install the package via the following command:

    pip install django-reactify

  2. Add “reactify” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'reactify',
    ]
  3. Run the following command:

    Ensure that the templates directory exists in the specified app name.

    python manage.py reactify <app_name>

    • Replace the app name with the existing Django app you want to reactify.

    • This command does the following:

      • Creates barbel and webpack configuration files in the app’s root directory.

      • Creates package.json file with the scripts to run React development server.

      • Creates a react folder directory with the necessary files and subdirectories where you can add your react component files and redux actions and reducers.

      • Creates a react folder directory with the necessary files and subdirectories where you can add your react component files and redux actions and reducers.

      • Installs the basic npm development packages.

      • starts the react development server that listens on the changes made to the react components and compile a minimal js file that is rendered to the view.

  4. cd to the django app directory and run the following command:

    npm run dev

  5. Add the new view function to the views file to render the compiled version of the react app.

    def index(request):

    template_name = ‘<app_name>/index.html’

    return render(request, template_name)

  6. Add more React components to the react app’s component folder.

Managing React Routes

If you don’t configure Django urls to accept the Routes declared in the react, you will encouter 404 error.

To fix this, lets say you have react routes as follows:

<Switch>

<Route exact path=”/” component={Main} />

<Route exact path=”/login” component={LoginPage} />

<Route exact path=”/services” component={ServicesPage} />

<Route exact path=”/about” component={AboutPage} />

In the app urls file use re_path,

from django.urls import re_path

from .views import index

urlpatterns = [

re_path(r’’, index, name=”home”), ]

Metadata

Release files for django-reactify 1.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-reactify 1.3.8
File Size Uploaded Provenance Actions
django-reactify-1.3.8.tar.gz 72.8 kB Without provenance Details for django-reactify-1.3.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-reactify 1.3.8
File Interpreter ABI Platform Actions
django_reactify-1.3.8-py3-none-any.whl Python 3 none any Details for django_reactify-1.3.8-py3-none-any.whl

Total release size: 148.3 kB

Release files / django-reactify-1.3.8.tar.gz

Download URL django-reactify-1.3.8.tar.gz
Size 72.8 kB
Tags Source
SHA-256 checksum
How to use checksums
79b5dc2abfab7e00e1869a10dd961e42af7dd8a9196bd698a37ef23489af395c
BLAKE2b-256 checksum
How to use checksums
3fa7f02d18e073a6e7233a9f6a3402796e4eac9f23513a9475ae6f5667f2641e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / django_reactify-1.3.8-py3-none-any.whl

Download URL django_reactify-1.3.8-py3-none-any.whl
Size 75.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14bfe14b599fa0629623d3faab0c88d00b03613637f6cf40ee310aeb0b4920e0
BLAKE2b-256 checksum
How to use checksums
a5d034904413e7b3c32f517d82e1d1c10da556a4882c34c5421304f85d62f63e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Security for django-reactify 1.3.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page