#Building Web Apps Fast ##Flask,Heroku, Syncano
###Heroku
Setting up Heroku:
#####Installin' Stuf'
- Get a free account
- Download the toolbelt
heroku login
- only required the first time you create a heroku app for verification purposes
#####Figurin' to Configure some things
-
create a
requirements.txt
file -->pip freeze > requirements.txt
- Unless you are on ubuntu. Then run this pruner after you do
pip freeze > requirements.txt
- Or make sure you set up a virtualenv and use the pip within your virtualenv
- Unless you are on ubuntu. Then run this pruner after you do
-
create a Procfile
- For most simple web apps you'll only need:
web: gunicorn app:app
- in general Procfile's have the following form:
<process type> : <command>
, for more info check this out
- in general Procfile's have the following form:
- For more advance web apps check out the foreman reference and an interesting example with web sockets
- concurrency with foreman:
-
Procfile: ``` web: gunicorn web:web
worker: python scraper.py ```
-
terminal command:
foreman start -c web=1, worker=2
-
- For most simple web apps you'll only need:
-
create a
runtime.txt
file- file contents:
python-2.7.6
- There is a known bug with gevent and python-2.7.9 that breaks ssl.
- file contents:
#####Terminal time
-
push your project up to git:
git init
git add -A
git commit -a -m "first commit"
git remote add origin [email protected]:[user-name]/[repo name].git
git push -u origin master
-
push your project to heroku:
git push heroku master
heroku ps:scale web=1
heroku open
###Syncano
-
setting environment variables - locally
- Ubuntu - edit .bashrc (you can get there by typing
cd ~
) - set instance name:
export SYNCANO_INSTANCE_NAME=[instance name]
ANDexport PATH="$SYNCANO_INSTANCE_NAME:$PATH"
to the end of the file. - set api key:
export SYNCANO_API_KEY=[api key]
ANDexport PATH="$SYNCANO_API_KEY:$PATH"
to the end of the file.
- Ubuntu - edit .bashrc (you can get there by typing
-
setting environment variables - on heroku:
heroku config:set SYNCANO_INSTANCE_NAME=[instance name]
herok config:set SYNCANO_API_KEY=[api key]
###Flask