A simple interface for cleaning/filtering out data (particularly videos).
index.html
contains the html page that will be displayed when you visit the appscript.js
contains the JavaScript that will be loaded onto this html page- The directory
server
contains the files that will be used to serve this code server.py
runs the serversave_data.py
contains helper functions for saving data
- (optional) Try out the server locally. This will help you understand what's going on and make sure everything is working.
- Set up a new virtualenv or conda environment. Install the dependencies from
requirements.txt
. - Run the server by running
python3 server/server.py
and go to the following url to see the front-end:localhost:8000
- If you want to test saving some data locally, you can change the variable
SAVE_METHOD
in the fileserver/server.py
toSaveMethod.LOCAL
. This will save your responses to the folderserver/data
. Try submitting something and check that it was saved in the correct format.
- Now let's put the app on the internet. We'll use Heroku because it's free and easy-to-use. Create a free Heroku account: https://www.heroku.com/
- Create a Heroku app and push this code to it. (Check out these instructions.
- In order to store data from your Heroku app, you'll need to setup a proper database instead of just the filesystem (Heroku automatically deletes files from the filesystem after a certain period). Make an account on mLab, which provides a MongoDB database with some amount of free storage in the cloud. Create a database with a collection called
data
. - In order for your app to use your mLab database, make the variable
SAVE_METHOD
inserver/server.py
is set toSaveMethod.MONGO
(should be set to this by default). You will also have to set an environment variable namedMONGO_URI
which you can use to access your database. See the functionsave_mongo
inserver/save_data.py
to see how this is used. For more help setting up your database properly, see the mLab documentation on connecting and the pymongo documentation. You will also need to set an environment variable in Heroku. - Test your app on Heroku and make sure that when you submit a new piece of data, you can see it in your mLab database.