Follow these steps to build, populate, and run the Melt-o-meter application. Prerequisites:
- Docker
- Docker Compose
- Git (or download the project files)
- Clone the project repository:
git clone https://github.com/tcbitt/meltometer.git
- Create a .env file in the project root. The docker-compose.yml and docker-entrypoint.sh show it needs these variables. Copy the entire block below into the .env and populate it with your desired credentials:
POSTGRES_DB=melt_o_meter_db
POSTGRES_USER=melt_o_meter_user
POSTGRES_PASSWORD=your_secret_password
# Django settings (must match the .env variables above)
DATABASE_URL=postgres://melt_o_meter_user:your_secret_password@db:5432/melt_o_meter_db
SECRET_KEY=your_django_secret_key
DEBUG=TrueBuild and start the web, nginx, and db services in detached mode.
docker-compose up -d --build
The web container will automatically wait for the database, collect static files, and apply migrations, as defined in docker-entrypoint.sh.
Execute the load_chemicals management command inside the running web container to populate the database. This can be done by navigating to the project folder that contains the docker-compose.yml and running this from the CLI.
docker-compose exec web python manage.py load_chemical
Execute the train_model command. This will query your database, train the RandomForestRegressor, and create model.joblib and chart_data.json.
docker-compose exec web python manage.py train_model
Go to http://localhost:8000/