Thursday, April 9, 2026

How To Deploy TurboGears 2 On Ubuntu 24.04 LTS

 TurboGears 2 (TG2) is an open-source, data-driven Python web framework designed for rapid development.
https://turbogears.org/
__________________________________________________________________________________________________________________
Testing Environment: Ubuntu 24.04.4 LTS                   Hostname -                       ip Address - 
__________________________________________________________________________________________________________________
apt update ; apt install build-essential net-tools curl git software-properties-common  python3 python3-pip python3-venv git python3-virtualenv 
mkdir ~/myproject
cd ~/myproject
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install turbogears2
nano webapp.py

from wsgiref.simple_server import make_server
from tg import MinimalApplicationConfigurator
from tg import expose, TGController

# RootController of our web app, in charge of serving content for /
class RootController(TGController):
    @expose(content_type="text/plain")
    def index(self):
        return 'Hello World'

# Configure a new minimal application with our root controller.
config = MinimalApplicationConfigurator()
config.update_blueprint({
    'root_controller': RootController()
})

# Serve the newly configured web application.
print("Serving on port 8080...")
httpd = make_server('', 8080, config.make_wsgi_app())
httpd.serve_forever()

python webapp.py
http://localhost:8080
__________________________________________________________________________________________________________________

Wednesday, April 8, 2026

How To Deploy Bottle Micro Framework On Ubuntu 24.04.4 LTS

 Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module and has no dependencies ||
https://bottlepy.org/docs/dev/
__________________________________________________________________________________________________________________
Testing Environment: Ubuntu 24.04.4 LTS                   Hostname - jitsi.tutorial.com                      ip Address - 
__________________________________________________________________________________________________________________
apt update ; apt install build-essential net-tools curl git software-properties-common zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev liblzma-dev python3.12-venv python3-pip -y


apt install python3.12-venv -y
python3 -m venv myproject
source myproject/bin/activate
pip install bottle
pip freeze > requirements.txt
deactivate

nano hello.py
from bottle import route, run

@route('/')
def index():
    return "Hello, World!"

run(host='0.0.0.0', port=8080)

chmod 777 hello.py 
python hello.py
__________________________________________________________________________________________________________________

Saturday, April 4, 2026

How To Deploy a FastAPI app And Set Up Gunicorn3 on 24.04 LTS

 FastAPI is a modern and high-performance Python web framework used to build APIs quickly and efficiently.
__________________________________________________________________________________________________________________
Testing Environment: Ubuntu 24.04.1 LTS                   Hostname -                       ip Address - 
__________________________________________________________________________________________________________________
apt update ; apt install build-essential net-tools curl git software-properties-common zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev liblzma-dev python3.12-venv python3-pip -y
python3 --version ; pip --version
mkdir environment ; python3 -m venv environment
cd environment/bin ; source activate

pip install fastapi
pip install 'uvicorn[standard]'
nano  main.py
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"Hello": "World"}

uvicorn main:app --reload
uvicorn main:app --host 85.159.231.14 --port 80 --workers 4 
__________________________________________________________________________________________________________________
Set Up Gunicorn3 to Serve the FastAPI Application -
pip install gunicorn
nano gunicorn_conf.py
bind = "0.0.0.0:8000"
workers = 4
gunicorn -k uvicorn.workers.UvicornWorker -c gunicorn_conf.py main:app
__________________________________________________________________________________________________________________

Thursday, April 2, 2026

How To run CherryPy Framework Ubuntu 24.04.4 LTS

CherryPy is a pythonic, object-oriented HTTP framework.
CherryPy stands on its own, but as an application server, it is often located in shared or complex environments. For this reason, it is not uncommon to run CherryPy behind a reverse proxy or use other servers to host the application.
https://docs.cherrypy.dev/en/latest/deploy.html
__________________________________________________________________________________________________________________
Testing Environment: Ubuntu 24.04.3 LTS                   Hostname - jitsi.tutorial.com                      ip Address - 
__________________________________________________________________________________________________________________
apt update ; apt install build-essential net-tools curl git software-properties-common python3-venv python3-pip
mkdir environment ; python3 -m venv environment
cd environment/bin ; source activate

pip3 install cherrypy
nano ./my_python_script.py

import cherrypy

class HelloWorld(object):
    @cherrypy.expose
    def index(self):
        return "Hello world!"

if __name__ == '__main__':
    cherrypy.quickstart(HelloWorld())

python3 ./my_python_script.py
__________________________________________________________________________________________________________________