Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# corise-zignite-devops-cc
# Intro to DevOps - Week 2 Project Starter Code
Binary file added quote_disp/__pycache__/app.cpython-38.pyc
Binary file not shown.
24 changes: 24 additions & 0 deletions quote_disp/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from flask import Flask, render_template
import random
import requests

app = Flask(__name__)

@app.route("/health")
def health():
return int(200)

@app.route("/")
def home():
return render_template('index.html')

@app.route("/get_quote")
def get_quote():

quote = requests.get('http://gen:5000/quote')
print('quote - ', quote)

return render_template('quote.html', quote = quote)

if __name__ == "__main__":
app.run(host="0.0.0.0", debug = True)
Binary file renamed requirements.txt → quote_disp/requirements.txt
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<meta charset="UTF-8">
<link rel="stylesheet" href="{{ url_for('static', filename= 'css/style.css') }}">
<title>Docker App</title>
<title>Quote Display Service</title>

</head>

<body>

<h1 style="color:white; " > Welcome to Project 1 (Docker App) </h1>
<h1 style="color:white; " > This is the Quote Display Service </h1>
<h2><a href = "{{ url_for('quote') }}">Click Here for the Quote</a></h2>

</body>
Expand Down
File renamed without changes.
22 changes: 14 additions & 8 deletions quote_app/app.py → quote_gen/app2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Flask, render_template
from flask import Flask
import random

app = Flask(__name__)
Expand All @@ -7,16 +7,22 @@

@app.route("/health")
def health():
return int(200)

@app.route("/")
def home():
return render_template('index.html')
return 'healthy'

@app.route("/quote")
def quote():

quotes = [
'The greatest glory in living lies not in never falling, but in rising every time we fall. -Nelson Mandela',
'The way to get started is to quit talking and begin doing. -Walt Disney',
"Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma – which is living with the results of other people's thinking. -Steve Jobs",
'If life were predictable it would cease to be life, and be without flavor. -Eleanor Roosevelt',
"If you look at what you have in life, you'll always have more. If you look at what you don't have in life, you'll never have enough. -Oprah Winfrey",
"If you set your goals ridiculously high and it's a failure, you will fail above everyone else's success. -James Cameron"
]

index = random.randrange(len(quotes))
return render_template('quote.html', quote = str(quotes[index]))
return str(quotes[index])

if __name__ == "__main__":
app.run(host="0.0.0.0", port=80)
app.run(host="0.0.0.0", debug = True)
Binary file added quote_gen/requirements.txt
Binary file not shown.
Loading