Python is a programming language that lets you work more quickly and integrate your systems more effectively.
- Supported versions
- Legacy versions
- Patch versions
- Path Considerations
- Additional Reading
You can still run these versions with Lando but for all intents and purposes they should be considered deprecated eg YMMV and do not expect a ton of support if you have an issue.
Not officially supported!
While we allow users to specify patch versions for this service they are not officially supported so if you use one YMMV.
To use a patch version you can do something like this:
services: my-service: type: python:3.5.6
But make sure you use one of the available patch tags for the underlying image we are using.
Here are the configuration options, set to the default values, for this service. If you are unsure about where this goes or what this means we highly recommend scanning the services documentation to get a good handle on how the magicks work.
services: my-service: type: python:3.7 port: 80 ssl: false command: tail -f /dev/null
Note that if you do not define a
command for this service it will effectively be a "cli" container eg it will not serve or run an application by default but will be available to run
python commands against.
If you want to actually launch a
python application consider setting the
command to something like:
services: my-service: type: python command: /app/my-server.py
While we assume your
python service is running on port
80 we recognize that many
python app's also run on port
8000 or otherwise. You can easily change our default to match whatever your app needs.
services: my-service: type: python port: 8000
Also note that
ssl: true will only generate certs in the default locations. It is up to user to use the certs and secure port correctly in their application like as in this
services: my-service: type: python ssl: true port: 443
// Starting HTTPS server httpsd = HTTPServer(('0.0.0.0', 443), myHandler) httpsd.socket = ssl.wrap_socket (httpsd.socket, server_side=True, certfile='/certs/cert.crt', keyfile='/certs/cert.key') print('starting https server...') httpsd.serve_forever()
Lando will set the following
PATH hierarchy for this service.
[ // Line directly below is your PYTHONUSERBASE '/var/www/.local/bin', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', ]
This is useful to note if you are not using absolute paths in any tooling routes and are getting the unexpected version of a particular utility.
If you are interested in a working example of this service that we test on every Lando build then check out https://github.com/lando/lando/tree/master/examples/python
- Updating your Landofiles to 3.0.0-rc.2+
- Accessing Your Services Externally
- Accessing Lando from Other Devices
- Exporting Databases
- Importing Databases
- Killer D8 Workflow with Platform.sh
- Lando + PhpStorm + Xdebug
- Offline Development
- Using $LANDO_INFO
- Using NodeJS Frontend Tooling
- Using Lando in Visual Studio Code
- Climbing a mountain for love
- SSH Keys
- Shared Files
- Global Config
- DNS Rebinding Protection
- File Uploads on Windows
- File Syncing Stalled
- Running VB and HyperV
- Running behind a proxy
- Switching Database Config