How do I share my code online?¶
So you've written some code -- perhaps it's a simple, fun guessing game, or perhaps it's a complicated statistical analysis calculator, perhaps it's a poetry generator, perhaps it's an evil AI ready to take over the world. Whatever it may be, you'd like to put it online, so other people can try it out.
It seems like simple request! But there isn't one perfect, simple way to do it.
Here are three possibilities that might work for you; each has its pros and cons.
Use the "Share" button in the Editor¶
The PythonAnywhere editor (from the Files tab) gives you the option to share a file -- look for the paperclip icon at the top of the editor.
This only works for single files, and people you share with will need a PythonAnywhere account.
Using a Gist Console¶
That requires uploading your code to GitHub as a "Gist", but then you can share it with anyone: https://www.pythonanywhere.com/gists/
By building a web app¶
This is the most work but offers the most flexibility. For that you'd need to learn the basics of one of python's web frameworks. We recommend these two tutorials:
PS - or you can go elsewhere¶
We should also mention our friends at Trinket.io, who have a platform that makes it really easy to share short scripts online.