Skip to content
A django website used in the book Practical Recommender Systems to illustrate how recommender algorithms can be implemented.
Python HTML Jupyter Notebook JavaScript
Branch: master
Clone or download
kimfalk Merge pull request #18 from walterbm/fix-similar-users-user-id-type
fix similar users by using a string type for user_id
Latest commit d1390ae Jun 1, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
analytics Updates the charField size for content ids Nov 20, 2018
builder Updates to ensure associations rules are created. Nov 17, 2018
collector Updates the charField size for content ids Nov 17, 2018
evaluator Add check if sum is zero Feb 19, 2018
moviegeeks Update models.py Oct 29, 2018
notebooks shorten line in notebook, and added seaborn to requirements Mar 29, 2018
prs_project Updates to support new Django Nov 17, 2018
recommender fix similar users by using a string type for user_id May 6, 2019
recs Exclude current item, when predicting ratings. Apr 25, 2018
static Fixed the javascript calls to the collector. Jun 20, 2016
templates fixes popover problem Nov 17, 2018
test Use Enumerate instead of range Mar 25, 2018
.gitignore Updates gitignore Aug 30, 2018
.travis.yml * integrating with Travis-ci Feb 19, 2018
LICENSE Create LICENSE Jan 8, 2018
README.md Fix the URL of themoviedb.org Dec 23, 2018
manage.py Early days of the new version May 18, 2016
populate_logs.py Updates to ensure associations rules are created. Nov 17, 2018
populate_moviegeek.py adds progressbar on populate_moviegeet Aug 24, 2018
populate_ratings.py adds tqdm progress bar to rating import Aug 24, 2018
populate_ratings_from_MovieLens_data.py * fiddled with evaluation of recommenders Jun 18, 2017
populate_sample_of_descriptions.py removing whitespace. Apr 25, 2018
requirements.txt Removes a double entry in requirements.txt Nov 17, 2018

README.md

moviegeek

The MovieGEEKs is a movie site implemented to accompany my book "Practical Recommender Systems". It is used in the book to show how recommender systems work, and how you can implement them.

The book is still being written, and so this is still under construction.

installation guide:

This site is using the MovieTweetings dataset, and uses themoviedb.org to get poster images. A big thanks to both of them for all their work. Please go and visit them.

The dataset is used in the populate_moviegeek script which downloads it and imports the data into the database configured in Django.

Project Setup

The following is expecting you to have python 3.x installed on your machine. I recommend looking that the Hitchhikers guide to Python if you haven't.

For windows users it's a good idea to install the Anaconda package. Anaconda is the leading open data science platform powered by Python (according to their homepage) Anaconda

Download code

> git clone https://github.com/practical-recommender-systems/moviegeek.git

Create a virtual environment for the project

Look at the following guide for more details guide

> cd moviegeek
> virtualenv -p python3 prs
> source prs/bin/activate

if you are running Anaconda you can also use conda virtual environment instead.

Get the required packages

pip3 install -r requirements.txt

[OPTIONAL] install and use PostGreSQL

Database setup

Django is setup to run with sqllite3 out of the box, and you can also use that when you run the site. However there are things that will be considerable faster if if you install postgres.

The database

If you dont have postgres running then you should start out installing it. It's a free, and easy to install.

Get it here postgresql download and follow the instructions on the site.

When it install and running, create a database. In the following the database is called moviegeek. You can do this using the admin tool (pgadmin)

The database driver

When the database is spinning its time for the python driver. I recommend using the following http://initd.org/psycopg/,

First download the driver, unzip (if zipped) then run

> python3 setup.py install
> pip3 install psycopg2

Configuration

To update the database in MovieGEEKS go to in prs_project/settings.py and update the following

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'db_name',                      
        'USER': 'db_user',
        'PASSWORD': 'db_user_password',
        'HOST': '',
        'PORT': 'db_port_number',
    }
}

you should update the NAME, USER, PASSWORD, HOST, PORT fields.

Create the dbs.

If you have a database running on your machine I would encourage you to connect it, by updating the settings in prs_project/settings.py (fx like shown above).

To set up another database is described in the Django docs here

> python3 manage.py makemigrations
> python3 manage.py migrate

Populate the db by running the following script.

(WARNING: this might take some time.) (WARNING: If you are using python >3.6 on a Mac then you need to run "/Applications/Python\ 3.6/Install\ Certificates.command". More details here)

> python3 populate_moviegeek.py
> python3 populate_ratings.py

Create a themoviedb.org id

  • go to https://www.themoviedb.org/account/signup and create an api_key
  • create a file in the root of the directory called ".prs" and add { "themoviedb_apikey": <INSERT YOUR APIKEY HERE>}. (remember to remove the "<" and ">") When you are finished, the file contents should look something like {"themoviedb_apikey": "6d88c9a24b1bc9a60b374d3fe2cd92ac"}

Start the web server

To start the development server run:

> python3 manage.py runserver 127.0.0.1:8000

Running the server like this, will make the website available http://127.0.0.1:8000 other applications also use this port so you might need to try out 8001 instead.

Closing down.

when you are finished running the project you can:

  • Close down the server by pressing -c
  • exit the virtual env:
> deactivate
You can’t perform that action at this time.