This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
falcon==1.3.0 | |
gunicorn==19.7.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
backend: | |
build: ./backend | |
ports: | |
- "9000:8000" | |
volumes: | |
- ../.:/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.6.2 | |
VOLUME ["/app"] | |
COPY start.sh /scripts/start.sh | |
WORKDIR /app/src | |
ENTRYPOINT ["/scripts/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
service ssh start | |
pip install --pre -U -r /app/src/.meta/packages | |
gunicorn app:app -c gunicorn.conf.py --reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app.py | |
import falcon | |
from api.resources import ( | |
RestResource, | |
) | |
from middlewares import ( | |
ContentEncodingMiddleware, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# middlewares.py | |
import json | |
class JSONEncoder(json.JSONEncoder): | |
def default(self, obj): | |
if isinstance(obj, bytes): | |
return obj.decode("utf-8") | |
return super(JSONEncoder, self).default(obj) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gunicorn.conf.py | |
import multiprocessing | |
bind = '0.0.0.0:8000' | |
workers = multiprocessing.cpu_count() * 2 + 1 | |
timeout = 30 | |
worker_connections = 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# api.py | |
from datetime import datetime | |
class RestResource: | |
def on_get(self, _, resp): | |
resp.body = { | |
'result': 'Wow! Resul!:)', | |
'timestamp': datetime.utcnow(), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
from middlewares import ( | |
ContentEncodingMiddleware, | |
) | |
app = falcon.API(middleware=[ | |
ContentEncodingMiddleware(), | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACCOUNTS_MAX_FRIENDS = 3 | |
# FRONTEND URL SECTION | |
FURL_CONTACTS = '/api/contacts/' | |
FURL_PROFILE = '/api/profile/' | |
FURL_ACCOUNTS = '/api/accounts/<%= accountId %>' | |
# BACKEND SECTION | |
SETTINGS_ROUTE = '/settings' |
OlderNewer