https://github.com/solarliner/django-serverside
A mind-bending, highly experimental Django project to render JS applications from the server-side.
https://github.com/solarliner/django-serverside
Last synced: 11 months ago
JSON representation
A mind-bending, highly experimental Django project to render JS applications from the server-side.
- Host: GitHub
- URL: https://github.com/solarliner/django-serverside
- Owner: SolarLiner
- License: mit
- Created: 2019-08-01T20:32:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-01T20:41:38.000Z (almost 7 years ago)
- Last Synced: 2025-04-06T08:17:27.779Z (about 1 year ago)
- Language: Python
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serverside for Django
A mind-bending, highly experimental Django project to render JS applications from the server-side.
## How this works
Each request received by Django spawns a short-lived Node.js process, called with a path to a JS file, and the
requested URL. Passed to standard input is the serialized context (QuerySet and Model instances included), as well
as the length of the stdin data as `NODE_CTX_LEN` in the environment.
The Node.js script is expected to return the HTML contents to stdout, which is then echoed with the response.
## Test the prototype
In order to test the included test application, you need Python 3.7 (including `pipenv`, as well as Node.js 10 (or
higher).
Run `yarn install` to install the Node.js dependencies, then `pipenv install --dev` to install the Python dependencies.
Migrate the SQLite database with `pipenv run python manage.py migrate`, and then launch the Django server with
`pipenv run python runserver`. Enjoy!