A system to help you store your favourite TV shows.
This is a basic practice session to go through the basics of WEB technologies with python backend, postgres and some code on front-end.
A dumb wireframe is provided in the design.html
file with will help you mix'n'match elements without lot of styling work.
- Clone this repo
- Open a terminal in the root folder of the cloned repository.
- Create a virtualenv:
virtualenv venv
- Activate the virtualenv:
source venv/bin/activate
- Install pip dependencies:
pip install -r requirements.txt
- Create a Postgres database for this project:
sudo -u postgres psql -c "CREATE DATABASE db_name_you_want;"
orsudo -u postgres createdb db_name_you_want
- Set the environment variables which the code uses to connect to the database. For this you have two ways:
- Using the IDE: for example if you use pyCharm, then editing the configuration you can set environment variables. The necesssary ones you can find in
setenv.sh.template
- Set the environment variables from the terminal. For this you can use our prewritten sh file (unix (linux) shell executables file):
- Make a copy of the
setenv.sh.template
file in the new name ofsetenv.sh
- Fill out the
setenv.sh
with YOUR details - Source the
setenv.sh
file in the command line with thesource setenv.sh
command. You have to do it from the same terminal where you start main.py later.
- Make a copy of the
- Using the IDE: for example if you use pyCharm, then editing the configuration you can set environment variables. The necesssary ones you can find in
- To create your database structure, you have 2 options, choose one:
- Using the pre-saved dump data:
- Run the
data/db_schema/01_create_schema.sql
SQL file to create empty tables - Unzip the
data/dump_1000_shows.zip
file - Run the unzipped sql files in the following order:
- genres
- shows
- show_genres
- seasons
- episodes
- actors
- show_characters
- Run the
- Download data dynamically
- Run the
data_inserter.py
Python script to scrape the API and download data dynamically.
- Run the
- Using the pre-saved dump data:
- Run the server with:
python main.py
or with the run configuration you set up in your IDE - After you stop the server run:
deactivate
in the command line to clean up the variables used (you do not need to if you used your IDE to run)