Skip to content

Commit e19d0e4

Browse files
committed
uswgi recovered, gunicorn removed
1 parent e3ee611 commit e19d0e4

File tree

8 files changed

+427
-0
lines changed

8 files changed

+427
-0
lines changed

Pipfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
certifi = "==2018.11.29"
8+
chardet = "==3.0.4"
9+
click = "==7.0"
10+
coreapi-cli = "==1.0.9"
11+
coreapi = "==2.3.3"
12+
coreschema = "==0.0.4"
13+
dj-database-url = "==0.5.0"
14+
django-filter = "==2.0.0"
15+
django-heroku = "==0.3.1"
16+
djangorestframework = "==3.9.0"
17+
gunicorn = "==19.9.0"
18+
httpie = "==1.0.2"
19+
idna = "==2.7"
20+
itypes = "==1.1.0"
21+
pbr = "==5.1.1"
22+
pipenv-to-requirements = "==0.6.1"
23+
pipenv = "==2018.11.26"
24+
"psycopg2" = "==2.7.6.1"
25+
pytz = "==2018.7"
26+
requests = "==2.20.1"
27+
uritemplate = "==3.0.0"
28+
"urllib3" = "==1.24.1"
29+
virtualenv-clone = "==0.4.0"
30+
virtualenv = "==16.1.0"
31+
whitenoise = "==4.1.2"
32+
Django = "==2.1.4"
33+
"Jinja2" = "==2.10"
34+
Markdown = "==3.0.1"
35+
MarkupSafe = "==1.1.0"
36+
Pygments = "==2.3.0"
37+
PyYAML = "==3.13"
38+
uwsgi = "*"
39+
40+
[dev-packages]
41+
42+
[requires]
43+
python_version = "3.7"

Pipfile.lock

Lines changed: 339 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apiconfig.wsgi

Whitespace-only changes.

wsgi/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""WSGI config for project.
2+
3+
This module contains the WSGI application used by Django's development server
4+
and any production WSGI deployments. It should expose a module-level variable
5+
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
6+
this application via the ``WSGI_APPLICATION`` setting.
7+
8+
Usually you will have the standard Django WSGI application here, but it also
9+
might make sense to replace the whole Django WSGI application with a custom one
10+
that later delegates to the Django one. For example, you could introduce WSGI
11+
middleware here, or combine a Django application with an application of another
12+
framework.
13+
"""
14+
import os
15+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'apiconfig.settings')
16+
17+
# This application object is used by any WSGI server configured to use this
18+
# file. This includes Django's development server, if the WSGI_APPLICATION
19+
# setting points here.
20+
from django.core.wsgi import get_wsgi_application # noqa
21+
application = get_wsgi_application()
22+
23+
# Apply WSGI middleware here.
24+
# from helloworld.wsgi import HelloWorldApplication
25+
# application = HelloWorldApplication(application)
26+
from .health_check import health_check # noqa
27+
28+
application = health_check(application, '/health/')
1018 Bytes
Binary file not shown.
528 Bytes
Binary file not shown.

wsgi/health_check.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def health_check(application, health_url):
2+
def health_check_wrapper(environ, start_response):
3+
if environ.get('PATH_INFO') == health_url:
4+
start_response('200 OK', [('Content-Type', 'text/plain')])
5+
return []
6+
return application(environ, start_response)
7+
return health_check_wrapper

wsgi/uwsgi.ini

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[uwsgi]
2+
die-on-term = true
3+
http-socket = :$(PORT)
4+
log-format = UWSGI uwsgi "%(method) %(uri) %(proto)" %(status) %(size) %(msecs)ms [PID:%(pid):Worker-%(wid)] [RSS:%(rssM)MB]
5+
master = true
6+
max-requests = 100
7+
memory-report = true
8+
module = wsgi:application
9+
processes = 4
10+
static-map = /static=/app/static

0 commit comments

Comments
 (0)