{"id":13707562,"url":"https://github.com/openanalytics/shinyproxy-flask-demo","last_synced_at":"2026-01-29T16:40:57.705Z","repository":{"id":140741735,"uuid":"385882070","full_name":"openanalytics/shinyproxy-flask-demo","owner":"openanalytics","description":"Running Flask apps inside ShinyProxy","archived":false,"fork":false,"pushed_at":"2024-05-21T13:50:21.000Z","size":33,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-08-03T22:20:23.079Z","etag":null,"topics":["containers","docker","flask","kubernetes","python","shinyproxy"],"latest_commit_sha":null,"homepage":"https://www.shinyproxy.io","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openanalytics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-14T09:20:35.000Z","updated_at":"2024-05-21T13:50:25.000Z","dependencies_parsed_at":"2024-01-17T08:42:00.939Z","dependency_job_id":"fcb3bd72-3808-4327-9fd3-881df573ed95","html_url":"https://github.com/openanalytics/shinyproxy-flask-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openanalytics%2Fshinyproxy-flask-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openanalytics%2Fshinyproxy-flask-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openanalytics%2Fshinyproxy-flask-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openanalytics%2Fshinyproxy-flask-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openanalytics","download_url":"https://codeload.github.com/openanalytics/shinyproxy-flask-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224484682,"owners_count":17319020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containers","docker","flask","kubernetes","python","shinyproxy"],"created_at":"2024-08-02T22:01:35.608Z","updated_at":"2026-01-29T16:40:57.693Z","avatar_url":"https://github.com/openanalytics.png","language":"HTML","readme":"# Running Flask apps inside ShinyProxy\n\nIn order to run Flask apps using ShinyProxy you have to consider two things:\n\n- use a WSGI web server to run the Flask app (e.g., gunicorn, uWSGI). This means\n  you cannot use the built-in server provided by Flask. Note that the developers\n  of Flask advice to not use their built-in server for production usages. The\n  [Dockerfile](Dockerfile) in this repository illustrates how you can setup\n  gunicorn for a very simple Flask application.\n- ensure to use the `url_for` helper when referencing other pages and static\n  files. The HTML files in the [app/templates](app/templates) directory show the\n  proper usage of the `url_for` helper. For example:\n  \n    ```html\n    \u003clink rel=\"stylesheet\" href=\"{{ url_for('static', filename='style.css') }}\"\u003e\n    \u003ca href=\"{{ url_for('about') }}\"\u003eAbout\u003c/a\u003e\n    \u003cimg width=\"400px\" src=\"{{ url_for('static', filename='logo.png') }}\"\u003e\n    \u003cscript src=\"{{ url_for('static', filename='script.js') }}\"\u003e\u003c/script\u003e\n    ```\n  \n## Building the Docker image\n\nTo pull the image made in this repository from Docker Hub, use\n\n```bash\nsudo docker pull openanalytics/shinyproxy-flask-demo\n```\n\nThe relevant Docker Hub repository can be found at \u003chttps://hub.docker.com/r/openanalytics/shinyproxy-flask-demo\u003e.\n\nTo build the image from the Dockerfile, navigate into the root directory of this repository and run\n\n```bash\nsudo docker build -t openanalytics/shinyproxy-flask-demo .\n```\n\n## ShinyProxy Configuration\n\n**Note:** ShinyProxy 2.6.0 or later is required for running Flask apps.\n\nCreate a ShinyProxy configuration file (see [application.yml](application.yml)\nfor a complete file), containing:\n\n```yaml\nproxy:\n  specs:\n    - id: flask-demo\n      container-image: openanalytics/shinyproxy-flask-demo\n      port: 8080\n      container-env:\n        SCRIPT_NAME: \"#{proxy.getRuntimeValue('SHINYPROXY_PUBLIC_PATH').replaceFirst('/$','')}\"\n      target-path: \"#{proxy.getRuntimeValue('SHINYPROXY_PUBLIC_PATH')}\"\n```\n\nNote that the `SCRIPT_NAME` environment variable may not end with `/`, therefore\nwe have to strip it from the variable.\n\n## References\n\n- \u003chttps://dlukes.github.io/flask-wsgi-url-prefix.html\u003e\n- \u003chttps://flask.palletsprojects.com/en/2.0.x/quickstart/#url-building\u003e\n- \u003chttps://gunicorn.org/\u003e\n- [Running FastAPI app in ShinyProxy](https://github.com/openanalytics/shinyproxy-flask-demo)\n\n**(c) Copyright Open Analytics NV, 2021-2024.**\n","funding_links":[],"categories":["HTML"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenanalytics%2Fshinyproxy-flask-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenanalytics%2Fshinyproxy-flask-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenanalytics%2Fshinyproxy-flask-demo/lists"}