This repository contains the final project for Group 6 which is an app that gets tweets about COVID-19 from twitter accounts and loads it into a table. You can run this example code locally, or deploy it to Heroku for free to see how it runs in a production-style environment.
You can check out our deployment with keys at: https://umuccmsc495g6project.herokuapp.com/
Heroku is a great way to get up and running fast, and you don't even need to open the terminal!
It's easy, and it's free! Just click on this button:
You can leave all the fields at their default values: we'll fill them in later. The only thing that matters right now is the app name, and Heroku will autogenerate a name for you if you leave that field blank. Using an autogenerated name is perfectly fine, just take note of what it is.
Note that your app isn't functional yet, and if you try to visit it right now, you'll end up at a 500 internal error page. That's OK, we're not done yet!
Visit https://developer.twitter.com/en/apps to register an app on Twitter. In order to register the application, you'll need that app name from Heroku.
Once you've registered your application on Twitter, Twitter will give you an app ID and app secret, which we'll use in the next step.
Go to Heroku and visit the settings page for your app. (You can get there from your Heroku dashboard, or by clicking on the "Manage App" button after the deploy step is finished.) On that page, there should be a section called "Config Variables" where you can manage the config vars for your application. You'll need click the "Reveal Config Vars" button to see which variables are available, and then the "Edit" button to allow you to change these variables.
Take the app ID you got from Twitter, and paste it into the "VALUE" field
next to the TWITTER_OAUTH_CLIENT_KEY
field, replacing the dummy value that
was there before. Similarly, take the app secret you got from Twitter,
and paste it into the "VALUE" field next to the TWITTER_OAUTH_CLIENT_SECRET
field, replacing the dummy value that was there before.
Click the "Save" button when you're done.
Your app name from Heroku will determine the URL that your app is running on:
the URL will be https://APPNAME.herokuapp.com
. For example, if Heroku
assigned you an app name of dingleberry
, your app will be available at
https://dingleberry.herokuapp.com
. Visit that URL, and you should
immediately be redirected to login with Twitter!
If you'd prefer to run this locally on your computer, you can do that as well.
Visit https://developer.twitter.com/en/apps to register an app on Twitter.
Once you've registered your application on Twitter, Twitter will give you an app ID and app secret, which we'll use in step 3.
Run the following commands on your computer:
git clone https://github.com/dannypenguin/CMSC495G6 cd CMSC495G6 source env/bin/activate pip install -r requirements.txt
These commands will clone this git repository onto your computer,
create a virtual environment for this project, activate it, and install
the dependencies listed in requirements.txt
.
Many applications use environment variables for configuration. You'll need to set the following environment variables:
TWITTER_OAUTH_CLIENT_KEY
: set this to the app ID you got from Twitter.TWITTER_OAUTH_CLIENT_SECRET
: set this to the app secret you got from Twitter.OAUTHLIB_INSECURE_TRANSPORT
: set this totrue
. This indicates that you're doing local testing, and it's OK to use HTTP instead of HTTPS for OAuth. You should only do this for local testing. Do not set this in production! [oauthlib docs]
If you're setting environment variables manually, run your app using Python:
FLASK_APP=app.py flask run
Then, go to http://localhost:5000/ to visit your app!
Fork this GitHub repo so that you can make changes to it.