Flask + uWSGI + nginx Primer
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.
How this shit works
- Flask is managed by
uWSGI
. uWSGI
talks tonginx
.
import ntlk | |
class SnowCastleStemmer(nltk.stem.SnowballStemmer): | |
""" A wrapper around snowball stemmer with a reverse lookip table """ | |
def __init__(self, *args, **kwargs): | |
super(self.__class__, self).__init__(*args, **kwargs) | |
self._stem_memory = defaultdict(set) | |
# switch stem and memstem | |
self._stem=self.stem |
upstream myapp { | |
server 127.0.0.1:8081; | |
} | |
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s; | |
server { | |
listen 443 ssl spdy; | |
server_name _; | |
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.
uWSGI
.uWSGI
talks to nginx
.