A movie/trailer catalog application that allows simple CRUD operations on a library of trailers.
- The Google Sign in functionality may not work from your local host - it does work from the demo site - so while the app might run on your local host not all the functionality will work
- In order for the app to work on localhost you have to modify the client_secrets.json with your own and set up the google api for the sign in. Instructions below.
- Google Sign in to restrict destructive CRUD operations to signed in users
- Movie Data Search (via OMDB API)
- Youtube Video Search (Youtube API)
- When you search for a movie, relevant data, posters and video for a trailer will be retreived and rendered on the same page (AJAX). You can improve search with the optional "year" field. Further you can add the searched movie to the library.
- Virtualbox
- $
vagrant init ubuntu/trusty64
- $
vagrant up
- $
vagrant ssh
- $
sudo apt-get install git -y
- $
cd /vagrant
- $
git clone https://github.com/xprmnts/dev_catalog.git
- $
mv dev_catalog/* .
this is necessary for apache to get the right paths that I've configured - $
rm -rf dev_catalog
clean up
- $
sudo ./pg_config.sh
this will take a few minutes, it might seem like nothing is happening for the first 4-5 mins...but just wait.
- $
sudo cp trailerApp.conf /etc/apache2/sites-available
- $
sudo cp trailerApp.conf /etc/apache2/sites-enabled
- $
sudo cp apache2.conf /etc/apache2/
- $
sudo service apache2 reload
(if server isn't started you might have to run start instead of reload) - $
sudo adduser catalog_owner
- $
sudo su - postgres
- $
createuser catalog_owner
- $
psql
- postgres=#
CREATE DATABASE trailer_catalog OWNER catalog_owner;
- postgres=#
\q
- $
psql trailer_catalog
- trailer_catalog=#
ALTER USER catalog_owner WITH PASSWORD 'pass1234';
You should use this password as I've configured the app to use this password, you can change it if you want but you'll have to change the dbsetup.py file to use your password. \q
exit out of the sql editor
- $
cd /vagrant
- $
psql trailer_catalog < trailer_catalog_db_backup.sql
- $
exit
switch back to vagrant user - $
exit
exit the vm
Reload VM (To take configuration from VagrantFile in repo - I made a minor tweak to port forwarding configuraiton)
- $
vagrant reload
- $
vagrant ssh
- $
sudo service apache2 start
- Open browser and access site from: localhost:8000
If you followed everything right you should see something like this Demo
The one thing that's a little suspect is step 11 - typically you'd run sudo a2ensite on the trailerApp.conf file in sites-available and a2dissite on the default apache file - but in all the test runs I did the steps above worked.
- The Genre Page: use /images/genre_background.jpg for a generic background, or use an image url
- The Trailer Page: Use the search feature to find a movie to add to the db ... or do it manually
- Try Logan and 2017 in search page for title and year or wonder woman!
- There may be bugs if you dont clear cache on your browser ... use incognito mode just in case.
- Go to your app's page in the Google APIs Console — https://console.developers.google.com/apis
- Create a project from the dropdown on the top nav
- Once the project is set up, select it in the dropdown on the top nav to go to it
- Choose Credentials from the menu on the left.
- It will ask you to configure consent screen
- Enter your email and the app name: "Trailr Catalog App"
- Create Credentials > select OAuth Client ID
- Choose Web Application in the following screen
- It will ask you to add origins and redirects:
- Origins:
- Redirects:
- You will then be able to download the client ID and client secret - name it client_secrets.json
- Overrite the existing file with your own
- This should enable the google sign in functionality after you reload the server in the vagrant vm
- Open the login.html page in the templates folder and modify the existing data-clientid attribute to use your newly generated client id.
- '/genres/JSON'
- '/trailers/JSON'
- '/users/JSON'
- '/genres/int:genre_id/trailers/JSON'
- '/genres/int:genre_id/trailers/int:trailer_id/JSON'
- I'd like to make use of configuration files to abstract out the API key's I used
- The login UI needs work, will add email auth and facebook oauth next
- Should optimize search to take into account already existing items in db before calling API's
- Should restrict CRUD to only add NEW items, currently duplicates are allowed