Skip to main content

Prerequisites

Before installing the application, ensure you have the following installed on your system:

Python 3.10+

Required for running the Flask application and data processing libraries

pip

Python package manager for installing dependencies

git

Version control system for cloning the repository

Virtual Environment

Recommended for isolating project dependencies
Python 3.10 or higher is required due to dependencies in the pandas and numpy libraries.

Installation Steps

1

Clone the Repository

First, clone the project repository to your local machine:
git clone <YOUR_REPOSITORY_URL>
cd meu_extrator
Replace <YOUR_REPOSITORY_URL> with your actual Git repository URL.
2

Create Virtual Environment

Create and activate a Python virtual environment to isolate project dependencies:
# Create the virtual environment
python -m venv venv

# Activate the environment
.\venv\Scripts\activate
When activated, you’ll see (venv) in your terminal prompt.
3

Install Dependencies

Install all required Python packages using pip:
pip install -r requirements.txt
This will install the following key dependencies:
PackageVersionPurpose
Flask3.1.2Web framework
pandas2.3.2Data manipulation
openpyxl3.1.5Excel file handling
weasyprint66.0PDF generation
python-dotenv1.1.1Environment variable management
The installation may take several minutes as WeasyPrint has multiple dependencies including fonttools, pillow, and rendering libraries.
4

Configure Environment Variables

Create a .env file in the project root directory to store sensitive configuration:
# Create the .env file
touch .env
Add the following content to the .env file:
.env
SECRET_KEY='your_secure_secret_key_here'
To generate a secure secret key, use Python:
import secrets
print(secrets.token_hex(32))
Copy the generated key and paste it into your .env file.
Never commit your .env file to version control. It should be listed in .gitignore.
5

Create Temp Directory

The application requires a temp directory for storing processed files:
mkdir temp
The application will automatically create this directory if it doesn’t exist when you run app.py, but creating it manually ensures proper setup.
6

Verify Installation

Verify that all components are properly installed:
# Check Python version
python --version

# Verify Flask installation
python -c "import flask; print(f'Flask {flask.__version__}')"

# Verify pandas installation
python -c "import pandas; print(f'Pandas {pandas.__version__}')"

# Check if .env file exists
ls .env
All commands should execute without errors.

Directory Structure

After installation, your project structure should look like this:
meu_extrator/
├── app.py                 # Main Flask application
├── requirements.txt       # Python dependencies
├── .env                   # Environment variables (you created this)
├── temp/                  # Temporary file storage (you created this)
├── templates/             # HTML templates
│   ├── index.html
│   ├── resultado.html
│   ├── config.html
│   └── historico.html
├── static/                # Static assets (CSS, JS, images)
└── venv/                  # Virtual environment (created by python -m venv)

Running the Application

Once installation is complete, start the Flask development server:
python app.py
You should see output similar to:
 * Serving Flask app 'app'
 * Debug mode: on
 * Running on http://127.0.0.1:5000
 * Press CTRL+C to quit
Open your web browser and navigate to:
http://127.0.0.1:5000
The application runs in debug mode by default, which provides helpful error messages and automatic reloading during development.

Troubleshooting

This means Flask is not installed. Ensure your virtual environment is activated and run:
pip install -r requirements.txt
The .env file is missing or not properly configured. Create the file with a valid SECRET_KEY as described in Step 4.
WeasyPrint requires system libraries for rendering. On Linux, install:
Ubuntu/Debian
sudo apt-get install python3-dev python3-pip python3-setuptools python3-wheel python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
On macOS with Homebrew:
macOS
brew install cairo pango gdk-pixbuf libffi
Run the mkdir command with appropriate permissions or create the directory manually with:
sudo mkdir temp
sudo chmod 755 temp

Next Steps

Quick Start Guide

Learn how to process your first CSV file and generate reports

Build docs developers (and LLMs) love