version alpha
DataVisualizer is a proof of concpet for Flask-based application for data visualization. This application is containerized using Docker and can be run in a local environment. This README will guide you through setting up and running the application in a Docker container.
Make sure you have the following installed on your machine:
- Docker
- Docker Compose
- Python 3.9 (for testing outside of Docker if needed)
pip
(Python package manager)
Before running the application, ensure to create an .env
file in the root directory that contains the required infos
.env
file:
DB_PATH="sqlDB.db"
OPENAI_API_KEY="Your_openai_apikey"
OPENAI_ORGA_ID="Your organization ID"
OPENAI_PROJECT_ID="Your project ID"
to get your organization ID and Project ID go to your settings page once you're done creating your profile.
The easiest way to run the application is by using Docker Compose. This will build the Docker image and start the application in a container.
-
Clone the repository:
git clone https://github.com/your-repo/data-visualizer.git cd data-visualizer
-
Build and run the container:
docker-compose up -d
This will:
- Build the Docker image from the provided
Dockerfile
. - Start a container for the application.
- The application will be available locally on port
8000
.
- Build the Docker image from the provided
-
Access the application: Open your web browser and go to:
http://localhost:8000
To stop the running containers, use:
docker-compose down
This will stop and remove the running containers but leave the built image intact.
/app
│ ├── dataVisualizer.py # Main Flask application
│ ├── init_data.py # Script to initialize database
│ ├── Dockerfile # Dockerfile for building the container
│ ├── entrypoint.sh # Entrypoint script for the container
│ ├── requirements.txt # Python dependencies
│ ├── .env # Environment variables
│ └── templates/ # HTML templates for the Flask app
│
└── docker-compose.yml # Docker Compose configuration
The Dockerfile performs the following tasks:
- Sets up a Python environment with required dependencies.
- Copies the application code into the container.
- Installs the necessary Python packages.
- Runs the Flask application using Gunicorn in production mode.
If you wish to run the application outside of Docker, you can do so using Python and pip.
-
Create a virtual environment (optional but recommended):
python3 -m venv venv source venv/bin/activate # On Linux/Mac venv\Scriptsctivate # On Windows
-
Install the dependencies:
pip install -r requirements.txt
-
Run the Flask application:
export FLASK_ENV=production python dataVisualizer.py
-
Access the application: Open your browser and navigate to:
http://localhost:8000
- Connection Refused Error: Ensure that Docker Compose is mapping the correct port (
8000:8000
). Check for any firewall settings that may block access to port 8000. - Permission Errors: Make sure the
entrypoint.sh
script has the correct execution permissions. Run:chmod +x entrypoint.sh
This project is licensed under the MIT License.