Web Application to Convert Currencies and Perform Calculations Statistics
This guide provides step-by-step instructions for setting up the development environment. The codebase utilizes Python with Flask for the backend and Tailwind CSS for the frontend.
Before you begin, ensure you have the following software installed on your system:
- Open a terminal or command prompt.
- Navigate to the directory where you want to store the codebase.
- Run the following command to clone the repository:
git clone https://github.com/YvesleCurseur/currency-converter-stats-calculator.git
currency-converter-stats-calculator/
│
├── screenshots/
│
└── static/
| └── css
| └── input.css
| └── output.css
|
├── templates/
│ └── base.html
│ └── conversions.html
│ └── convert.html
│ └── statistics.html
│ └── trends.html
|
├── utils/
│ └── currency_codes.py
│ └── statistics.py
|
├── templates/
│ └── base.html
│ └── conversions.html
│ └── convert.html
│ └── statistics.html
│ └── trends.html
|
├── .gitignore
├── app.py
├── config.py
├── env.example
├── models.py
├── package-lock.json
├── package.json
├── README.md
├── requirements.txt
└── tailwind.config.js
In this structure:
currency-converter-stats-calculator/
: Directory for the codebase.screenshots/
: Directory for screenshots.static/
: Directory for static files like CSS.templates/
: Directory for HTML templates.utils/
: Directory for utility modules or functions.app.py
: Main application file..gitignore
: List of ignored files and directories.config.py
: Configuration file for Flask.models.py
: Contains database models and request to the database.requirements.txt
: List of required packages for flask.env.example
: Example .env file.package.json
: List of required packages for npm and Tailwind CSS.tailwind.config.js
: Tailwind CSS configuration file.README.md
: Project documentation.
- Navigate to the root directory of the cloned repository.
- Run the following command to create a virtual environment:
python -m venv venv
- Activate the virtual environment:
or
.\venv\Scripts\activate
source venv/bin/activate
This application utilizes environment variables for configuration.
Change the env.example
to a .env
file in the root directory. Add the following variables:
Ensure the following environment variables are set:
FLASK_APP=app
ENV=DEVELOPEMENT
FLASK_DEBUG=True
# Amdoren Currency Converter
EXCHANGE_API_KEY="Your API key for accessing the ExchangeRate-API."
EXCHANGE_URL="https://v6.exchangerate-api.com/v6"
Use the API key from the ExchangeRate-API by signing up for an account or use this one here:
93...
- Navigate to the root directory of the cloned repository.
- Install Python dependencies:
pip install -r requirements.txt
- Install Node.js dependencies:
npm install
-
To enable the Tailwind CSS style, build the CSS file:
npm run buildcss
-
Start the Flask app by running:
flask run
-
Navigate to http://127.0.0.1:5000 in your browser.
In your terminal, you should see the following output:
In the directory of the codebase, you should be able to see a currency_data.db
appearing.
currency-converter-stats-calculator/
│
├── screenshots/
│
└── static/
| └── css
| └── input.css
| └── output.css
|
├── templates/
│ └── base.html
│ └── conversions.html
│ └── convert.html
│ └── statistics.html
│ └── trends.html
|
├── utils/
│ └── currency_codes.py
│ └── statistics.py
|
├── templates/
│ └── base.html
│ └── conversions.html
│ └── convert.html
│ └── statistics.html
│ └── trends.html
|
├── venv/
│
├── .env
├── .gitignore
├── app.py
├── config.py
├── currency_data.db
├── models.py
├── package-lock.json
├── package.json
├── README.md
├── requirements.txt
└── tailwind.config.js
- Dependency Issues: Ensure correct versions of Python and Node.js/npm are installed. Check
requirements.txt
andpackage.json
for correct dependencies. - Flask App Not Running: Check for missing dependencies or incorrect configurations in the Flask application.
- Tailwind CSS Build Error: Verify paths in
tailwind.config.js
for input and output files.
In utils/statistics.py, you can find the following functions:
calculate_statistics_for_currency(currency_code)
This function calculates the statistics of all amounts converted for a specified currency.
compare_statistics_for_currencies()
This function compares the statistics of all amounts converted for each currency available in the database.
calculate_mean_conversion_amounts_by_currency()
This function calculates the mean conversion amounts for each currency and provides trend messages indicating whether the conversion amounts are rising, dropping, or stable.
Here some screenshots of the application: