Skip to content
Development and deployment2 min read

What is Python?

Short answer

Python is a general-purpose programming language known for clean, English-like syntax. It's used to build websites with frameworks such as Django, Flask and FastAPI, as well as Telegram bots, automation scripts, data analysis and AI applications.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. How Python runs web apps
  2. Example: a tiny Flask app
  3. Common problems
  4. On ArabyHost

Guido van Rossum created Python, and the first version came out in 1991. It runs through an interpreter, so there’s no compile step, it ships with a broad standard library, and the PyPI index hosts hundreds of thousands of extra packages.

How Python runs web apps

A normal script runs and exits. A web app needs an application server that receives HTTP requests and hands them to your code through a standard interface:

Interface Frameworks Example servers
WSGI Django, Flask Gunicorn, Phusion Passenger
ASGI FastAPI, Django Channels Uvicorn

Packages are installed with pip inside a per-project virtual environment, with a requirements.txt file listing what the project needs. Outside the web, Python usually runs as scripts started by hand or on a schedule: one that collects data, say, or emails a daily report.

Example: a tiny Flask app

# app.py
from flask import Flask
app = Flask(__name__)

@app.route("/")
def home():
    return "Hello from Python"

Under Passenger, all you need is a passenger_wsgi.py that exposes an application variable:

from app import app as application

Common problems

  • ModuleNotFoundError: the package was installed into a different environment than the one the app runs in: see that error’s page.
  • externally-managed-environment: the system blocks pip install outside a virtual environment, per PEP 668.
  • Version mismatch: a library that needs Python 3.11 won’t run on 3.9.
  • Indentation: Python uses indentation to define blocks, and mixing tabs with spaces raises IndentationError.

On ArabyHost

AI/Developer plans offer Python 3.9 to 3.12 through cPanel’s Setup Python App, the CloudLinux selector that creates the virtual environment and runs your app with Phusion Passenger. ASGI apps such as FastAPI need a WSGI adapter, as the FastAPI guide explains. Bots and background jobs run as processes kept alive by a cron job: see the Telegram bot guide. There’s no GPU, so running large AI models on the server itself isn’t a fit, but calling hosted models through an API works well.

FAQ

What's the difference between Python 2 and Python 3?

Python 2 reached end of life at the start of 2020, and all modern libraries require Python 3. Code that uses print without parentheses was written for Python 2 and needs updating.

What's the difference between WSGI and ASGI?

WSGI is the synchronous interface traditionally used by Django and Flask; ASGI is the asynchronous one that FastAPI and real-time features need. Your application server must support the interface your framework uses.

Is Python slower than PHP or Node.js for websites?

For most sites the difference is small next to the impact of the database and caching. Performance depends far more on how the app is written than on the language.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.