We can use Python 3 on Glitch.com. I showed you how (see the posts at the end of this post) to do it with flask. Now I want to show how to do it with just Python.
Glitch.com allows you to create web apps for free, so it is greatly reccomanded. The IDE that you can use make you see the results of your code immediately, so it’s superfun and supereasy to use. Another massive fact is that you can use Python at ease. Let’s see how.
You can access to Python 3.5 through a virtual machine that runs Ubuntu 16.04.5. Go create an account on Glitch.com and start a new project. You will need the following files to get started:
- requirements.txt
- start.sh
- app.py
requirements.txt
This is the firs file you’ll need. Into this one write:
aiohttp==2.3.10
start.sh
This is the content
pip3 install --user -r requirements.txt python3 app.py
app.py
This is what you need in app.py to make the site work
from aiohttp import web async def handle_index(request): return web.Response(text=""" My First Async Python 3 Web App Welcome to my first app on Glitch.com made in Python 3.5. """) if __name__ == '__main__': app = web.Application() app.router.add_get('/', handle_index) web.run_app(app)
Now, when you will show your project you will see:
My First Async Python 3 Web App
in the browser.
This is the site on glitch.me pythonskratch.glich.me