pip install python-dotenv
pip install requests
npm install -g flask
npm install -g heroku
#Spotify API Setup
- Head to
https://developer.spotify.com/dashboard/login
- Login with your spotify account, if not create one
- Click to create an app
- Give it a name and a discription
- You should see your Client ID
- Click to reveal Client Secret
- Have Client ID and Secret at the ready
-
Create
.env
file in your project directory -
Add your client ID + secrets for Spotify and token for Genius in this format to
.env
:export Client_ID="{YOUR CLIENT ID}"
export Client_Secret="{YOUR CLIENT SECRET}"
#Deploying on Heroku
- Go to
https://www.heroku.com/
and create an account to deploy to Heroku - Create a requirements file by running:
touch requirements.txt
- Run
pip freeze > requirements.txt
- Create a Procfile by running:
touch Procfile
- open
Procfile
and add the line:web: python app.py
- Commit and push to github by running:
git commit -m "message of your own"
followed bygit push origin main
- Login to Heroku by running
heroku login -i
- Enter your login credentials for Heroku
- Run
heroku create
to create an application on Heroku - Push to heroku by running
git push heroku main
- Run the command
heroku open
to open the heroku site. If it doesnt open, it will give you a manual link to open in your browser with
#Genius API Setup
-
Head to
https://docs.genius.com/
-
Click on
API client management page
-
Login or Signup for an account
-
Click on
New API Client
-
Give it a name
-
Enter the URL from Heroku for
App Website URL
-
Click on
Generate Access Token
to get the access token for Genius API -
Add your Genius Access Token to
.env
in the following format:export Genius_Token="{YOUR GENIUS TOKEN}"
- Run
git commit -m "message of your own"
followed bygit push origin main
- Run
git push heroku main
to push to heroku - Run
heroku open
to run the application and view the site - If it doesnt open, there should be a link to visit manually, click on link to view the site
- Allowing the user to search for their own artists.
I plan on using this api to get the artist ID:
'https://api.spotify.com/v1/search?q=Artist+Name&type=artist'
- Bluring the background color of the preview div.
I plan on doing this by adding a
filter: bulr(#px)
, but an issue with this is that this adds a blur to all sub tags, so will need to figure out how to unblur the sub tags
-
Fix 404 issues with song preview link:
- Noticed that my application was returning 404 in the terminal
- So I look a look at what aspect of the website was causing the issue
- Narrowed down to preview audio, as it wasn't pointing to the correct link
- Recalled reading in Slack about someone having issues with song preview links
- Printed out what the output for song preview link, found out the song with issues printed None
- Tried to do an if statement in jinja comparing the variable to "None"
- This didn't work, because the None being printed out was of type None, not string None(found out by looking up None issue on StackOverflow)
StackOverflow Link:
https://stackoverflow.com/questions/21095654/what-is-a-nonetype-object/34570099
- I proceeded to do an if statement in python to check if its of None type, if so set it to string None
- Proceeded with doing string comparison in jinja, where it worked correctly
-
Padding issue between by song preview and top track list
- After separating the preview and top track list into their own divs, noticed there was some blank space between the divs
- Went straight to google to figure out how to remove the whitespace
- Noticed that the solution was related to padding and margin
StackOverflow Link:
https://stackoverflow.com/questions/18315507/remove-margin-between-divs
- Recalled from my IT202 class that you can specify which side of the div you want to modify
- So I did the padding and margin modification to the bottom of the song preview div and the top for the track list div
-
Had issues with figuring out how to set up header and parameter for Genius API
- Was trying to get the Genius API working, but hit wasn't working correctly
- Realized that if I had just scrolled down on the documentation, the answer was right there
- Scrolled down to
Authentication
category - Read the documentation and modified my code to work