The MovieGEEK is a website initially implemented to accompany my book, Practical Recommender Systems. However, this folder is used for the manning LiveProject, which is currently in MEAP.
The website is not intended as a standalone tutorial or a plug-and-play website for you to install and use for your content.
This site would not be working if it wasn’t for the MovieTweetings dataset and the poster images provided by the themoviedb.org API. I wish to extend a big thanks to both of them for all their work.
In the following, we will go through the steps to set up this site.
The first thing is to download this repository. Secondly, create a themoviedb.org ID needed to run the website.
You have two choices for downloading the source code – downloading a zip file of the source code or using Git.
Downloading a zip file
From the main MovieGEEK directory on GitHub, click the green “Clone or download” button and choose to download a zip file to your computer.
Using Git
Clone this repository or create a fork in your GitHub, and then clone that instead. The following command
will create a copy on your computer.
> git clone https://github.com/kimfalk/live-project.git
You have to create an ID with themoviedb.org to use its pictures.
There are two ways to run the site:
I recommend the first option, as the docker container way is faster and requires less setup.
As a new addition to this site, this repo will also have a docker container, which should make it easier to start.
Fire up the website simply by first building the docker container
docker-compose build web
Create the database and download and import data: (This takes some time)
./db-migrate.sh
And then start it executing the following:
docker-compose up web
NB: If the website responds with an error about a .prs
file missing, its because you skipped
the section about creating a themoviedb.org id. link
(to close it again by stopping the process (Cltr+C))
The MovieGEEK website requires that you have Python 3.x installed. Practical Recommender Systems does not teach you Python, though. You’ll need to be able to read Python code to understand the algorithms, and, of course, programming experience makes it easier to implement the website.
The Hitchhikers guide to Python provides “both novice and expert Python developers a best practice handbook to the installation, configuration, and usage of Python on a daily basis.” Mac and Linux users should follow instructions in this guide.
Windows users, because installing Python and its packages can be tricky for you, I recommend using the Anaconda package for the simplest install. If you want to, you can use the Windows instructions in the Hitchhiker’s Guide, but I have always used the Anaconda package.
Before you run the code, create a virtual environment. The Hitchhiker’s Guide provides a good overview if you want more information. Verify that you have virtualenv installed, and if not, read more here. If you followed the Hitchhiker’s Guide or used Anaconda, it should already be installed, though. Use this command to verify it’s installed:
> virtualenv --version
Once you have confirmed you have virtualenv installed, create the virtual environment using the following commands (Anaconda users, please use the Anaconda-specific commands):
> cd live-project
> virtualenv -p python3 prs
> source prs/bin/activate
> cd live-project
> conda create -n prs python=3.6
> conda activate prs
Note that 3.6 should be replaced with 3.x, with x representing the version you are using.
There are Anaconda specific instructions for this step, too; be sure to use those if they apply!
Non-Anaconda users
Use pip to install the required files:
> pip3 install -r requirements.txt
Anaconda users
Thanks, TechnologyScout.net for these instructions:
> while read requirement; do conda install --yes $requirement; done < requirements.txt
Django is setup to run with Sqllite3 out of the box, which is enough to run everything. However, some things will be considerably faster if you install PostGreSQL.
Django comes with a database that enables you to run the website without an external database. However, using another database makes it faster. I had good experiences using the PostGreSQL db.
First, install Postgres and run it. Download the correct postgresql version for your operating system here, and follow the instructions on from the download page to install and run it.
Use PostGreSQL’s admin tool pgadmin to create a database. Name it moviegeek
. Write down which username and password you usd to create the database. You will use that information in two steps from now when you change the Django settings.
Once the PostGreSQL database is spinning, it’s time for the Python driver, which enables Django to talk with the database. I recommend using Psycopg. Download it here. Install it following these instructions.
If you use a PostGreSQL (or another db) you need to configure the Django database connection for MovieGEEKS, follow these steps. Refer to Django docs here if you need more details.
Open prs_project/settings.py
Update the following:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'moviegeek',
'USER': 'db_user',
'PASSWORD': 'db_user_password',
'HOST': 'db_host',
'PORT': 'db_port_number',
}
}
Update the USER, PASSWORD, HOST, and PORT fields:
For more information please refer to the Django documentation link
Everyone must follow these steps, whether or not you are using PostGreSQL.
When the database connection is configured, you can run the following commands to create the databases that Django and this website need to run.
> python3 manage.py makemigrations
> python3 manage.py migrate --run-syncdb
Run the following script to download the datasets for the MovieGEEKS website.
WARNING: Mac users running Python 3.7 or higher, before you populate the databases, you need to run this command.
/Applications/Python\ 3.7/Install\ Certificates.command
. More details here
and here.
Everyone, run these commands to populate the databases.
> python3 populate_moviegeek.py
> python3 populate_ratings.py
WARNING: This might take some time.
To start the development server, run this command:
> 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
WARNING: Other applications also use this port so you might need to try out 8001 instead.
NB: If the website responds with an error about a .prs
file missing, its because you skipped
the section about creating a themoviedb.org id. link
When you are finished running the project you can close it down doing the following steps, or simply close the terminal where the server is running.
Non-Anaconda users
> deactivate
Anaconda users
> conda deactivate
To restart the project again do the following:
> cd moviegeek
> source prs/bin/activate
> cd moviegeek
> conda activate prs
Start the web server again by running the following command:
> python3 manage.py runserver 127.0.0.1:8000