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.
A Pen by Nick Robinson on CodePen.
| user nobody nogroup; | |
| worker_processes 1; | |
| pid /var/run/nginx.pid; | |
| error_log /var/log/nginx/error.log; | |
| events { | |
| worker_connections 1024; | |
| accept_mutex off; | |
| } |
| set -g default-terminal "screen-256color" | |
| set -g history-limit 100000 | |
| # use VI | |
| set-window-option -g mode-keys vi | |
| set -g mode-keys vi | |
| # Use ctrl-e instead of ctrl-b | |
| set -g prefix C-e | |
| unbind C-b |
| spawn = require('child_process').spawn | |
| express = require('express') | |
| app = express() | |
| generatePDF = (callback) -> | |
| child = spawn('phantomjs', [__dirname+'/render.coffee']) | |
| child.stdout.on 'data', (data) -> | |
| callback(null, data) | |
| child.stdout.on 'error', (err) -> | |
| callback(err) |
| set -g default-terminal "screen-256color" | |
| set -g history-limit 100000 | |
| # use VI | |
| set-window-option -g mode-keys vi | |
| set -g mode-keys vi | |
| # Use ctrl-e instead of ctrl-b | |
| set -g prefix C-e | |
| unbind C-b |
| Resource.h | |
| ---------- | |
| @interface Resource : NSObject | |
| + (void)save:(NSError **)error; | |
| @end | |
| Resource.m | |
| ---------- | |
| @implementation Resource | |
| + (void)save:(NSError **)error { |
| # This is a configuration file for ProGuard. | |
| # http://proguard.sourceforge.net/index.html#manual/usage.html | |
| -dontusemixedcaseclassnames | |
| -dontskipnonpubliclibraryclasses | |
| -verbose | |
| # Optimization is turned off by default. Dex does not like code run | |
| # through the ProGuard optimize and preverify steps (and performs some | |
| # of these optimizations on its own). | |
| -dontoptimize | |
| -dontpreverify |
| syntax enable | |
| set nocompatible | |
| filetype off | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| Plugin 'VundleVim/Vundle.vim' |