Skip to content

openanalytics/shinyproxy-django-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Running Django apps inside ShinyProxy

This repository demonstrates how to run Django apps inside ShinyProxy.

Building the Docker image

To run the Django app inside ShinyProxy, it should be packaged as a Docker image. By default, django ships with its own development server, which is not suitable for production use. Instead, you should use a production-ready server such as Gunicorn or uWSGI. For this purpose you will need to add an entrypoint for your server to your application.
In app/app.py the following should be present:

application = get_wsgi_application()

On top of that, we should configure django to use the FORCE_SCRIPT_NAME environment variable to serve the app under the correct subpath in app/app.py:

if FORCE_SCRIPT_NAME:
    settings_kwargs["FORCE_SCRIPT_NAME"] = FORCE_SCRIPT_NAME
    settings_kwargs["STATIC_URL"] = f"{FORCE_SCRIPT_NAME}/static/"
else:
    settings_kwargs["STATIC_URL"] = "/static/"

settings.configure(**settings_kwargs)

To build the Docker image, run the following command:

docker build -t openanalytics/shinyproxy-django-demo .

ShinyProxy configuration

Create a ShinyProxy configuration file (see application.yml for a complete example), containing:

proxy:
  specs:
    - id: django
      container-image: openanalytics/shinyproxy-django-demo
      port: 8000
      container-env:
        FORCE_SCRIPT_NAME: "#{proxy.getRuntimeValue('SHINYPROXY_PUBLIC_PATH')}"

Screenshot

(c) Copyright Open Analytics NV, 2026.

About

Running Django apps inside ShinyProxy

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors