Python Code in Github Pages - Noob needs help #21596
-
Hello there, I am making a webpage for a report of a study. I would like people to be able to view plots based on inputs they give. I have that code ready in Python. How do I add it to my Github Page? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
That is not possible. GitHub Pages support only static pages, nothing that runs code on the server. For that you’ll have to find a host that lets you deploy web applications, or containers, or however else you’d like to deploy your service. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply. I went on GitHub Pages because I watched this video. https://youtu.be/2MsN8gpT6jY?t=38. This is what my output might look like. How do you think these guys did it? thanks again. |
Beta Was this translation helpful? Give feedback.
-
That diagram is probably animated with CSS and Javascript, so the animation is running on the client side. If you can do it all in Javascript, a user could provide data to the script running in their browser and have it rendered, but it’d be gone as soon as they close the page (though you could include some export). Or you could store the data to generate diagrams in your repository, and use Actions to build a static site using your Python code and commit that to the branch published by Pages. In that case users could suggest datasets to add via pull requests. |
Beta Was this translation helpful? Give feedback.
-
@airtower-luna Thank you so much for your help. |
Beta Was this translation helpful? Give feedback.
-
https://pyscript.net/ is an option |
Beta Was this translation helpful? Give feedback.
That diagram is probably animated with CSS and Javascript, so the animation is running on the client side. If you can do it all in Javascript, a user could provide data to the script running in their browser and have it rendered, but it’d be gone as soon as they close the page (though you could include some export).
Or you could store the data to generate diagrams in your repository, and use Actions to build a static site using your Python code and commit that to the branch published by Pages. In that case users could suggest datasets to add via pull requests.