A simple content based recommendation application. NLP model is trained in another repository. This application makes recommendation given input using pre-trained model.
Docker allows you to run this application on every operating system. The only requirement is to have running Docker engine instance. If it is installed and running, docker run hello-world command returns "Hello from Docker!" text. Otherwise, please head over to https://docs.docker.com/get-started/#download-and-install-docker and go through the installation steps.
- Download this repository to your local machine directly from here or via Git:
git clone https://github.com/TUM-IDP-WS-20/simple-recommender.git
- In the root directory, run
docker-compose up
That's all you need to do! Docker build and run 3 containers:
- lrs_app : The main literature recommender system
- nginx : An Nginx Webserver to welcome requests first and redirect them to the LRS app running behind the nginx
- lrs_db : A Postgresql database to store user ratings
These all steps may take up to 5 minutes depending on your network connection. Once installation is done, you can reach the application on http://localhost.
Note: If you want to make changes on the code, this option has one drawback that you need to delete the image created for 'lrs_app' and rerun docker-compose up to build and run 'lrs_app' service.
virtualenv --python=python3.8 .venvsource .venv/bin/activatepip3 install -r requirements.txt-
- Make sure that you have installed
postgresqlon your computer. - Create a database with the following credentials:
-
Username: user
-
Password: password
-
Database Name: rec_database
-
Host: localhost
-
Port: 5432
-
Use docker/lrs_database_init.sql for initial tables
OR simply run a prepared postgres container via:
docker-compose run localDb bash
-
- Set environment variables
export APP_SETTINGS="app.config.DevelopmentConfig" export DATABASE_URL="postgresql://user:password@localhost:5432/rec_database"
- Make sure that you have installed
-
Run the command below to run the application:
flask run
You can reach the application on http://localhost:5000
-
Install git lfs(Check up-to-date doc: https://git-lfs.github.com/)
git lfs install git lfs pull
-
Make sure that you have installed
postgresql.- docker-compose run localDb bash
- export APP_SETTINGS="app.config.DevelopmentConfig"
- export DATABASE_URL="postgresql://localhost:5432/rec_database"
- python3 manage.py db init
- python3 manage.py db migrate
- python3 manage.py db upgrade
-
Run the command below to run the application:
flask run
You can reach the application on http://localhost:5000
-
All dependencies will be saved in
requirements.txt. If a new library is needed for a notebook, please update dependecies onrequirements.txtaccordingly. You can follow the steps below to update it quickly:- Be sure to activate the environment as shown in 1.ii.
- Install the packages that you need like
pip3 install <package name> - Update the
requirements.txt:
pip3 freeze -r requirements.txt > requirements.txt
-
- Access Create a Heroku account and install heroku CLI. You can follow instruction here: https://devcenter.heroku.com/articles/getting-started-with-python
- Login
heroku login
- Add
herokuremote upstream url
git remote add heroku https://git.heroku.com/simple-recommender.git
- Fetch heroku branch
git fetch heroku master
- Database Config
heroku config:set APP_SETTINGS=app.config.ProductionConfig --remote herokuheroku addons:create heroku-postgresql:hobby-dev --app simple-recommender
-
- Commit changes
Merge changes to
masterbranch - Deploy Then, push changes to heroku to trigger new deployment:
git push heroku master
- Commit changes
Merge changes to
-
heroku config --app simple-recommendergit push heroku master:master --no-verifyheroku run python manage.py db upgrade --app simple-recommender