sasha-ajin / django-app-reactjs-integrate

Django app for integration with ReactJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

django-app-reactjs-integrate

What is it?

This is django app for integration with ReactJS

Usage

After installation you can insert ReactJS, which is assembled with webpack, to your template with script tag

<script src={% static 'frontend_build/main.js' %}></script>

Or use default frontend_view from views.py for every url path

from frontend.views import frontend_view
from django.urls import path

urlpatterns = [
    ...
    path("url_path/", frontend_view, name="url_name"),
]

Installation to django project

Firstly install the app

git clone https://github.com/sasha-ajin/django-app-reactjs-integrate.git

Setting up django

After that, rename the app to frontend

mv django-app-reactjs-integrate/ frontend

Add frontend to your INSTALLED_APPS

INSTALLED_APPS = [
    ...
    'frontend'
]

Also, you should have static folder in your django project, which should be available on your.domain.name/static/

Setting up ReactJS

Inside frontend folder install nodejs

npm install

And assemble ReactJS in a single file

npm run dev

About

Django app for integration with ReactJS


Languages

Language:JavaScript 63.9%Language:HTML 18.6%Language:Python 17.5%