The purpose of this website is for users to rank movies preferentially and then compare their rankings against everyone else in the website. The main theme we had in mind when creating this website was avoiding choice paralysis. This website would be curated by small team with only a few (<=10) polls available to vote on at one time. These polls would be rotated out regularly (weekly, biweekly, etc.), replaced with new polls created by the admin team. To avoid dissatisfaction from the userbase due to movies they believe should be included, the movies in the polls should be chosen based on a mix of critical reception and/or audience reception. More specific topics are also great for avoiding this issue as the likely candidate pool would shrink (e.g: The best movie of 2019 vs The best movie sound design of 2019). This would also get users thinking more deeply about movies. Sidenote: We had initially intended to rank multiple forms of media (movies, music and games) but we scaled down due to time constraints and overcomplexity. This is why in the code, we refer to movies as media. TODO explain social mechanism/voting mechanism used.
The voting page for each poll consists of a set of all the movie "posters", or which may be dvd covers or images of the actual movie posters. The user selects them in the order they feel best fits the poll. (eg: For the best sci-fi horror poll, I select Event Horizon first, followed by Alien, etc). To prevent confusion, when an option is selected, it disappears, meaning it can not be selected again or unselected. If the user is unhappy with their choices, they may choose to participate again. Doing so will remove all all their previous votes for that particular poll before starting. Each movie is assigned a number when the user votes for them, from 1 to however many movies are in the poll (no more than 10). Once this has been done. The data is stored in a votes table. These votes can be aggregated to produce the global results for a particular poll.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes (tested on Linux and macOS).
While in your virtual environment, install the following:
- Flask-WTF
pip install flask-wtf
- SQLAlchemy and Flask-SQLAlchemy
pip install flask-sqlalchemy
- Flask-Migrate
pip install flask-migrate
- Flask-Login
pip install flask-login
- Flask-Admin
pip install flask-admin
- Pillow
pip install pillow
- python-dotenv
pip install -U python-dotenv
You will need to be in a virtual environment whenever you run the server or follow the below instructions. You can run it without one, but we are not responsible if anything goes wrong.
Use the following commands:
Virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
Use the following commands:
flask db init
flask db migrate
flask db upgrade
- Open add_admin.py and replace 'admin' in
u = User(username='admin', admin = 1)
with your desired username and replace 'admin' inu.set_password('admin')
with your desired password - Then use
python add_admin.py
to add the admin account
Once you have added the first admin account, adding further admin accounts is made easy using the User page of the admin view of the website.
Simply use flask run
to start the server. You can then head to
localhost:5000 or 127.0.0.1:5000 to see the website in action.
To run the unit tests, use python testing.py
When the unit tests are finished you will need to:
flask db migrate
flask db upgrade
to rebuild the database.
- test_set_password
- Tests ability to assign and hash a password to a user
- test_delete_account
- Tests ability to delete a user
- test_already_voted
- Tests ability to check if a user has already voted on the poll passed to the function
- test_remove_user_poll
- Tests ability to remove previous votes made on the poll passed to the function
- test_all_polls
- Tests ability to return all polls a user has participated in
- test_poll_results
- Tests ability to return results of a poll if the user has participated in it
- test_add_media
- Tests ability to add media to a poll
- test_remove_media
- Tests ability to remove media from a poll
- test_voters
- Tests ability to return all participants of a poll
- test_totals
- Tests ability to return global (multiuser) rankings of a poll
- test_contains
- Tests ability to chcek if a poll contains a certain media
- test_cover
- Tests ability to return the first movie poster of a poll
- test_close_all
- Tests ability to deactivate all active polls (i.e. archive polls)
- test_front
- Tests that the front page functions
- test_about_us
- Tests that the about us page functions
- test_login_logout
- Tests that the login and logout functionality works
- test_archives
- Tests that the archives page doesn't allow users not logged in
- test_register
- Tests that the register page functions
- test_missing
- Tests that the 404 page displays properly
- Bootstrap - Javascript Library
- Jquery - Javascript Library
- Flask - Web Framework
- and of course good 'ol HTML, CSS and Javascript
- Billtone Mey Oum (21806052) - Initial work - billmey
- Conor Smith (21959981) - Initial work - conor-smith
This project is licensed under the GNU General Public License v3.0 or later - see the LICENSE.md file for details
- PurpleBooth for the readme template
- IMP Awards for various movie posters
- Miguel Grinberg for the mega tutorial