Menu

1 / 2

Managing Dependencies with Poetry for a Flask App on Ubuntu 24.04

DEV Community: flask·Sanskriti Harmukh·about 21 hours ago
#7i2CRn4b
#devtoflask#devto#dev#fullscreen#enter
Reading 0:00
15s threshold

Poetry is an open-source tool for managing and packaging dependencies for Python projects. It maintains a clean view of your dependency tree, streamlines the installation and management of dependencies, and simplifies packaging and distribution to PyPI. This guide installs Poetry with Pipx on Ubuntu 24.04, creates a virtual environment, and runs a Flask application using Poetry and Gunicorn. By the end, you'll have a Flask app managed entirely through Poetry, tested with Pytest, and served in production mode with Gunicorn.

Prerequisites

Before you begin, you need to:

Have access to an Ubuntu 24.04 server.

Install Poetry with Pipx

Installing Poetry in an isolated environment prevents conflicts between Poetry's internal dependencies and system-wide dependencies.

1. Update the APT package index:

$ sudo apt update

Enter fullscreen mode

Exit fullscreen mode

2. Install Pipx:

$ sudo apt install pipx -y

Enter fullscreen mode

Exit fullscreen mode

3.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.