Post/Redirect/Get-like approach for React + Django AJAX apps
Project description
logicore-django-react-pages
PRG-like approach for React + Django AJAX apps
Use together with: React counterpart
and on top of: Running React and Django on a single port
Usage
-
Assuming your main apps' name is
main -
Add to
views.py(as an example):
from logicore_django_react_pages.views import ApiView
class HomeView(ApiView):
url_name = "home"
url_path = "/"
WRAPPER = "MainWrapper"
TEMPLATE = "HomeView"
title = "Home"
def get_data(self, request, *args, **kwargs):
return {"name": "World"}
- Add to
urls.py
from logicore_django_react.urls import react_reload_and_static_urls, react_html_template_urls
from main import views # required to register subclasses for ApiView
from logicore_django_react_pages.views import all_api_urls
urlpatterns = [
# ...
*all_api_urls(), # in any position
# ...
]
# add static/media endpoints here if needed
# urlpatterns += static(...)
# lastly, combine with logicore_django_react urls
urlpatterns = react_reload_and_static_urls + urlpatterns + react_html_template_urls
- Install & configure ReactJS counterpart: https://github.com/Logicore-project/logicore-react-pages#installation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logicore-django-react-pages-1.0.0.dev8.tar.gz.
File metadata
- Download URL: logicore-django-react-pages-1.0.0.dev8.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be80b94d2e249b9c30f1e2c930a64794a293154b235bec7af0d809554cd439b4
|
|
| MD5 |
1b6e5868120dc9fa173c1f1ad076f48a
|
|
| BLAKE2b-256 |
3dc11e497affbfa924a785ac145ebade6511dc13294175dac9c659c3b2304657
|
File details
Details for the file logicore_django_react_pages-1.0.0.dev8-py3-none-any.whl.
File metadata
- Download URL: logicore_django_react_pages-1.0.0.dev8-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33dc7f876b3a33c2842ba78b7a5d6723659dce014b76e8eca52f279b98ee79cd
|
|
| MD5 |
8763479452aa21b32c75858f64b4e140
|
|
| BLAKE2b-256 |
5589f511554715dcb47db34309cee2e6fcbac13837521f9f180be44e43b6b575
|