This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
**/__pycache__ | ||
app_files/logs/** | ||
app_files/db.sqlite3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
**/__pycache__ | ||
app_files/logs/** | ||
app_files/db.sqlite3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,5 @@ | |
|
||
urlpatterns = [ | ||
path('', views.datetime_view), | ||
path('visits', views.visits), | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
from django.http import HttpResponse | ||
from datetime import datetime | ||
import pytz | ||
import os | ||
|
||
|
||
DATETIME_TIMEZONE = pytz.timezone('Europe/Moscow') | ||
DATETIME_FORMAT = "%d/%m/%Y %H:%M:%S" | ||
|
||
def datetime_view(request): | ||
current_moscow_datetime = datetime.now(DATETIME_TIMEZONE) | ||
return HttpResponse(current_moscow_datetime.strftime(DATETIME_FORMAT)) | ||
time_string = current_moscow_datetime.strftime(DATETIME_FORMAT) | ||
if not os.path.exists('logs'): | ||
os.mkdir('logs') | ||
f = open("logs/access.txt", "a") | ||
f.write(time_string) | ||
f.write("\n") | ||
f.close() | ||
return HttpResponse(time_string) | ||
|
||
def visits(request): | ||
f = open("logs/access.txt", 'r') | ||
file_content = f.read().replace("\n", "<br>") | ||
f.close() | ||
return HttpResponse(file_content) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Lab 12 config output | ||
|
||
``` | ||
kezzyhko@kezzyhko-laptop:~/windesktop/DevOps/k8s$ kubectl get po | ||
NAME READY STATUS RESTARTS AGE | ||
time-app-chart-588c77b667-hf886 1/1 Running 1 (40h ago) 8d | ||
time-app-deployment-5bcc57b5c7-6lvcd 1/1 Running 0 4m31s | ||
time-app-deployment-5bcc57b5c7-dr49l 1/1 Running 0 4m31s | ||
kezzyhko@kezzyhko-laptop:~/windesktop/DevOps/k8s$ kubectl exec time-app-deployment-5bcc57b5c7-6lvcd -- cat /app/config.json | ||
{ | ||
"config_key": "config_value" | ||
}kezzyhko@kezzyhko-laptop:~/windesktop/DevOps/k8s$ | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"config_key": "config_value" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadadata: | ||
name: example-config | ||
data: | ||
config.json: |- | ||
{{ .Files.Get "files/config.json" }} |
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
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