Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lectures/07_Infrastructure_and_Workflow/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:3.4
MAINTAINER Python course at Bauman University

RUN apk add --update python3 py-pip

RUN mkdir /app
WORKDIR /app

COPY requirements.txt /app
RUN pip install -r requirements.txt

COPY app.py /app

ENTRYPOINT ["python"]
CMD ["app.py"]
Empty file.
13 changes: 13 additions & 0 deletions lectures/07_Infrastructure_and_Workflow/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from flask import Flask


app = Flask(__name__)


@app.route('/')
def hello_world():
return 'Embrace the containerization'


if __name__ == '__main__':
app.run(host='0.0.0.0')
34 changes: 34 additions & 0 deletions lectures/07_Infrastructure_and_Workflow/log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import logging


logger = logging.getLogger('park')
logger.setLevel(logging.DEBUG) # А если поменять на WARNING?

lite_handler = logging.StreamHandler()
lite_handler.setLevel(logging.DEBUG) # А если тут?

formatter = logging.Formatter('lite [%(name)s] %(levelname)s: %(asctime)s - %(message)s')
lite_handler.setFormatter(formatter)

logger.addHandler(lite_handler)

# heavy_handler = logging.StreamHandler()
# heavy_handler.setLevel(logging.ERROR)
#
# formatter = logging.Formatter('heavy [%(name)s] %(levelname)s: %(asctime)s - %(message)s')
# heavy_handler.setFormatter(formatter)
#
# logger.addHandler(heavy_handler)


logger.debug('debug message')
logger.info('info message')
logger.warning('warning message')
logger.error('error message')
logger.critical('critical message')


# try:
# 1 / 0
# except ZeroDivisionError:
# logger.exception('What could go wrong?')
1 change: 1 addition & 0 deletions lectures/07_Infrastructure_and_Workflow/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask==0.11
Binary file not shown.