I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.
- Flask is managed by
uWSGI. uWSGItalks tonginx.
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| // State example: | |
| // | |
| // $stateProvider | |
| // .state('state', { | |
| // url: 'state/:id', | |
| // template: stateTemplate, | |
| // controller: stateController, | |
| // // Expose parameters in display names using {:param} syntax | |
| // displayName: 'State ({:id})' | |
| // }); |
| var fs = require('fs') | |
| var Q = require('q') | |
| var fs_stat = Q.denodeify(fs.stat) | |
| var fs_readdir = Q.denodeify(fs.readdir) | |
| var files = [ | |
| './fixtures/file1', | |
| './fixtures/file2', | |
| './fixtures/file3', | |
| './fixtures/file4' |
| // knockout 2.2.1 | |
| ko.utils.arrayFilter = function (array, predicate) { /* .. */ } | |
| ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ } | |
| ko.utils.arrayForEach = function (array, action) { /* .. */ } | |
| ko.utils.arrayGetDistinctValues = function (array) { /* .. */ } |
| def getLocationMap(): | |
| locations=Location.objects.all().order_by('-date') | |
| location_array={} | |
| for location in locations: | |
| location_array[location.id]=[str(location.longitude),(location.latitude),location.note,location.title] | |
| return location_array | |
| //JAVASCRIPT | |
| var location_array= $.parseJSON("{{ location_array }}"); |