Skip to content

Commit c4df7ac

Browse files
Initialized by DevStream
Initialized by DevStream
2 parents d612412 + 6bf2a52 commit c4df7ac

File tree

9 files changed

+87
-0
lines changed

9 files changed

+87
-0
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.venv/
2+
3+
*.pyc
4+
__pycache__/
5+
6+
instance/
7+
8+
.pytest_cache/
9+
.coverage
10+
htmlcov/
11+
12+
dist/
13+
build/
14+
*.egg-info/

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM python:3.10-alpine
2+
3+
WORKDIR /code
4+
5+
COPY ./requirements.txt /code/requirements.txt
6+
7+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8+
9+
COPY ./wsgi.py /code/
10+
COPY ./app /code/app
11+
12+
USER 1000
13+
14+
CMD ["gunicorn", "--conf", "app/gunicorn.conf.py", "--bind", "0.0.0.0:8080", "wsgi:app"]

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# dtme2epython
2+
3+
This is a repo for app dtme2epython; bootstrapped by DevStream.
4+
5+
By default, the automatically generated scaffolding contains:
6+
7+
- a piece of sample Python [Flask](https://flask.palletsprojects.com/en/2.2.0/) web app
8+
- sample unittest
9+
- .gitignore
10+
- requirements.txt
11+
- wsgi.py
12+
- Dockerfile
13+
- Helm chart
14+
15+
## Test
16+
17+
```shell
18+
python3 -m unittest
19+
```

app/dtme2epython.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
5+
6+
@app.route("/")
7+
def hello():
8+
return "Hello, World!"
9+
10+
11+
if __name__ == "__main__":
12+
app.run(host='0.0.0.0')

app/gunicorn.conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Gunicorn config variables
2+
loglevel = "info"
3+
errorlog = "-" # stderr
4+
accesslog = "-" # stdout
5+
worker_tmp_dir = "/dev/shm"
6+
graceful_timeout = 120
7+
timeout = 120
8+
keepalive = 5
9+
threads = 3

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Flask==2.2.0
2+
gunicorn==20.1.0

test/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test/test_dtme2epython.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import unittest
2+
3+
from app.dtme2epython import hello
4+
5+
6+
class TestHello(unittest.TestCase):
7+
def test_hello(self):
8+
self.assertEqual(hello(), "Hello, World!")
9+
10+
11+
if __name__ == '__main__':
12+
unittest.main()

wsgi.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from app.dtme2epython import app
2+
3+
if __name__ == "__main__":
4+
app.run()

0 commit comments

Comments
 (0)