reactpy-django
reactpy-django copied to clipboard
Serve web modules via Django static files
trafficstars
Current Situation
Currently, we serve our JavaScript web modules (JavaScript Components) via views. This is due to the fact that our current architecture does not let us know what web modules exist until runtime.
However, Django views are less efficient at serving files than a webserver such as Nginx or Apache.
Proposed Actions
Develop a way of integrating with the Django Static File system.
Work Items
We have a couple of paths we could take
- Create a static file finder that points to ReactPy's web modules directory
- This is the preferred implementation if feasible
- Develop a
collect_modulescommand, similar to django-compressor'scollect_staticcommand- This option requires changes in ReactPy to deterministically collect all JavaScript web modules during startup.
- Also, what should we do if we accidentally did not obtain a static file during startup? Should we fallback to using our Django view, or just throw a
500: Internal Server Error?
- Make users put JavaScript modules in dedicated
JAVASCRIPT_MODULES = [ ... ]folder(s)- User's will need to statically define their ReactPy JavaScript modules with this method.
See #4 for the original issue.
Blocked on idom-team/idom#786