reactpy-django icon indicating copy to clipboard operation
reactpy-django copied to clipboard

Serve web modules via Django static files

Open Archmonger opened this issue 3 years ago • 1 comments
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

  1. Create a static file finder that points to ReactPy's web modules directory
    • This is the preferred implementation if feasible
  2. Develop a collect_modules command, similar to django-compressor's collect_static command
    • 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?
  3. 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.

Archmonger avatar Jan 31 '22 04:01 Archmonger

Blocked on idom-team/idom#786

Archmonger avatar Aug 17 '22 01:08 Archmonger