A Django app to call server functions directly from the client.
Project description
forthright-django
forthright-django is a Django app to allow developers to directly call server functions from the client.
Quick start
-
pip install forthright-django -
Add forthright-django to INSTALLED_APPS in your django project settings.py:
INSTALLED_APPS = [ ..., 'forthright_django', ] -
Include the forthright-django URLconf in your django project urls.py:
urlpatterns = [ path('forthright/', include('forthright_django.urls')), ..., ] -
Instantiate a forthright_server object and export your server functions. For example, place examples/server_functions.py in your django project folder, and import this file in urls.py
from . import server_functions -
Now you can instantiate a forthright_client object on the client and directly call the server functions that you exported. For example, examples/client.py
All together, here's an example django project:
And corresponding client:
Limitations
You can only pass arguments by value, not by reference. For example, if an argument is a list, the server function will receive a copy of that list.
If an argument is a custom object, the class definition must be present in both the client code and the server code.
Warning: By default, this code deserializes pickled data on the server which is unsafe. There is an optional Safe Mode to instead send data with json, but this will prevent you from sending custom objects. To turn on Safe Mode, set safe_mode=True when instantiating both forthright_server and forthright_client:
frs = forthright_server(safe_mode=True)
frc = forthright_client(url, safe_mode=True)
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 forthright_django-0.0.6.tar.gz.
File metadata
- Download URL: forthright_django-0.0.6.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57fc8f43e6669827b75b4b625a449a447af8b0247de8bfdad21b1b87fc7ced21
|
|
| MD5 |
33fcccd8fd60af58effb1c94bfdfc45f
|
|
| BLAKE2b-256 |
a6bc29eb85b8cc4937cbb5a0f269e0de929984e20bb9ccfe2b7f9e016330bcd6
|
File details
Details for the file forthright_django-0.0.6-py3-none-any.whl.
File metadata
- Download URL: forthright_django-0.0.6-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cb2a7ef6ba7eabb77aba25d38e4c6dcd2b1795a617cc98858ca0ca7bbc1377e
|
|
| MD5 |
e133a57163ef122368343b2c81b03f2c
|
|
| BLAKE2b-256 |
ec734f1cae0098b7af68fc78f70edd1e55ed086de0d7491f1c67a98ab78eb67e
|