Skip to content

Instantly share code, notes, and snippets.

@heidmotron
heidmotron / README.md
Last active April 9, 2019 03:37
Python3 app using cf tasks

Push an app

Push an app with a main web process that runs forever (in this case it does nothing) and there is no healthcheck

Download main.py, http-call.py, and requirement.txt into a directory. Then from that directory, run:

cf push py-simple -b https://github.com/cloudfoundry/python-buildpack.git -c "python main.py"  -u none
# Existing
action = url_for(:action => options[:action], :id => record)
# action should be the result of url_for which would be a string
# then it gets shoved into a hash where url_for will get called once again
contents = form_tag({:action => action}, :method =>(options[:method] || 'post'), :enctype => options[:multipart] ? 'multipart/form-data': nil)
# The patch
action = {:action => options[:action], :id => record}
// since it's synchronous it waits till the request is finished before the window closes
window.onbeforeunload = function() {
new Ajax.Request('/', {method: 'get', asynchronous: false})
};