This project is being developed using Flask/Python, HTML & CSS.
It was created as an assigment for the 'Dynamic Web Development' class at ITP/NYU under John Schimmel's supervision.
-
Download the sample code
-
Navigate to code directory in Terminal. Create Git repo
git init git add . git commit -m "initial commit"
Create virtual environment and install requirements
virtualenv venv . runpip
-
Create a new Heroku app
heroku create
Heroku offers a lot of different Add-ons for your apps. Many different types of databases, image tools, cache utilities are available from 3rd party companies. Many offer a trial plan to test and develop with before you commit to a paid plan.
MongoLabs offers a 250MB MongoDB instance for free (see here) : ) How wonderful.
To install the MongoLabs
-
Navigate to the code folder of your app
-
In Terminal, add the MongoLab starter plan
heroku addons:add mongolab:starter
This has added MongoLab to your app.
When adding Add-ons, Heroku will add the required configuration variables for the services including username, password, urls, etc.
We must create a local configuration file to allow our local development server to connect to the MongoLabs MongoDB instance. We can grab a copy of our Heroku configuration variables and put them inside a .env file, our environment variable file.
Run the following command inside your code folder.
heroku config --shell | grep MONGOLAB_URI >> .env
This will create a new file, .env and it will contain a single line starting with MONGOLAB_URI and followed by a long connection url. This is the username and password for your MongoLabs account.
.env
MONGOLAB_URI=mongodb://heroku_app8083291:sadlfkwewe........
We want GIT to ignore the .env file, VERY IMPORTANT This keeps our environment variables safe and they won't get included inside our GIT repository (or worse, get pushed to Github).
Open your .gitignore file and add '.env' on a new line. Save the file.
.gitignore
.env
venv
*.pyc
. start
or
foreman start