Professional Documents
Culture Documents
Setup Project Moovie GEEKs
Setup Project Moovie GEEKs
Setup Project Moovie GEEKs
com/practical-recommender-systems/moviegeek
Steps to setup project:
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
Login, go to your account settings and create an API. You can access settings by
clicking the avatar in the upper right-hand corner (the default is a blue circle with a white
logo in it). Then you’ll see settings on the left.
Create a file in the moviegeek directory called ".prs"
Open .prs and add { "themoviedb_apikey": } Remember to remove the "<" and ">" When
you are finished, the file contents should look something like {"themoviedb_apikey":
"6d88c9a24b1bc9a60b374d3fe2cd92ac"}
3. Running the site
There are two ways to run the site:
I recommend the first option, as the docker container way is faster and requires less
setup.
Create the database and download and import data: (This takes some time):
./db-migrate.sh
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))
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.
Once you have confirmed you have virtualenv installed, create the virtual
environment using the following commands (Anaconda users, please use the
Anaconda-specific commands):
Non-Anaconda users:
> cd live-project
> virtualenv -p python3 prs
> source prs/bin/activate
Anaconda users:
> 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.
Non-Anaconda users
> while read requirement; do conda install --yes $requirement; done < requirements.txt
5. Database setup
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.
If you do want to install Postgres, follow the Postgres installation steps before you
create the databases.
If you don’t want to install Postgres, jump to Create and populate the MovieGEEKS
databases section.
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.
Create the database for MovieGEEK
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.
Configure the Django database connection to connect to PostGreSql
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:
USER(db_user): Use the user name you created with the MovieGEEK database
PASSWORD(db_user_password): Use the password you created with the
MovieGEEK database
HOST (db_host): localhost (if you have have installed it on your private machine)
PORT (db_port_number): 5432 (the default port)
When the database connection is configured, you can run the following commands
to create the databases that Django and this website need to run.
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.
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