Skip to content

Commit 5dbdb4c

Browse files
committed
chore: upgrade
1 parent d73eac4 commit 5dbdb4c

File tree

6 files changed

+67
-63
lines changed

6 files changed

+67
-63
lines changed

README.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
# flask-hello-world
2-
This is a simple flask application
32

4-
# Overview
3+
This is a simple flask application
4+
5+
## Overview
6+
57
![hello_ahmed](/img/hello_ahmed.png)
68

7-
# Running this app
9+
## Running this app
810

911
This app is designed to run in different ways:
12+
1013
1. As a standalone app running on your machine
11-
2. As a Docker container running locally
14+
2. As a Docker container running locally
1215
3. As a Docker image published in Docker Hub
13-
4. As an application hosted by [IBM Cloud](https://https://www.ibm.com/cloud)
16+
4. As an application hosted by [IBM Cloud](https://https://www.ibm.com/cloud)
1417

1518
## 1. As a standalone app
1619

17-
1. install [python](https://www.python.org/)
20+
1. install [python](https://www.python.org/)
1821
2. `git clone` the project then `cd` into the directory
1922
3. run `virtualenv -p /usr/bin/python3 venv`or `python -m venv venv` to create a virtual environment
2023
4. activate it using `source venv/bin/activate`
@@ -23,7 +26,7 @@ This app is designed to run in different ways:
2326
### running the app
2427

2528
After installing, run the server using `python app.py`
26-
Access the running app in a browser at the URL written to the console (most likely http://localhost:5000)
29+
Access the running app in a browser at the URL written to the console (most likely <http://localhost:5000>)
2730

2831
## 2. As a Docker container running on your machine
2932

@@ -32,30 +35,32 @@ Access the running app in a browser at the URL written to the console (most like
3235
3. run `docker build -t flask-hello-world:latest .` to build the docker image
3336
4. `docker images` list the local avaible images
3437
5. run `docker run --name flask_hello_world -d -p 8000:5000 --rm flask-hello-world:latest` to start the container
35-
6. Navigate to http://localhost:8000 in a browser to see the results. If you want to share it with your local network devices navigate to http://[your-ip-address]:8000
38+
6. Navigate to <http://localhost:8000> in a browser to see the results. If you want to share it with your local network devices navigate to http://[your-ip-address]:8000
3639

3740
## 3. As a Docker image published in Docker Hub
41+
3842
Docker Hub is a free service to publicly store available images.
43+
3944
1. you need to install only [Docker](https://www.docker.com/)
40-
2. just run `docker run -d -p 8080:5000 --name flask ahmnouira/flask-hello-world`
45+
2. just run `docker run -d -p 8080:5000 --name flask ahmnouira/flask-hello-world`
4146

4247
![my_doker_hub](/img/docker_hub.png)
4348

44-
## 4. As an application hosted by IBM Cloud
49+
## 4. As an application hosted by IBM Cloud
50+
4551
:octocat: Before you begin, verify that you have completed the below steps:
4652

47-
* you have access to an [IBM Cloud account](https://cloud.ibm.com/registration).
53+
* you have access to an [IBM Cloud account](https://cloud.ibm.com/registration).
4854
* the [IBM Cloud CLI](https://cloud.ibm.com/docs/cli?topic=cloud-cli-getting-started) is installed in your workstation.
4955

50-
1. clone the repository by running `git clone https://github.com/AhmNouira/flask-hello-world`
51-
2. `cd flask-hello-world`
56+
1. clone the repository by running `git clone https://github.com/AhmNouira/flask-hello-world`
57+
2. `cd flask-hello-world`
5258
2. run `bx login` to login to your IBM cloud account and enter your email and password
53-
3. `bx target --cf ` to target the Cloud Foundary
54-
To check the default organization and space to which you have access, go to https://cloud.ibm.com/account/cloud-foundry.
59+
3. `bx target --cf` to target the Cloud Foundary
60+
To check the default organization and space to which you have access, go to <https://cloud.ibm.com/account/cloud-foundry>.
5561
4. `bx cf push` to push the application to IBM Cloud
56-
5. if you found any error run `bx cf logs flask-hello-world --recent ` to see the troubleshoot
62+
5. if you found any error run `bx cf logs flask-hello-world --recent` to see the troubleshoot
5763
6. check whether your app is running `bx cf app flask-hello-world`
5864
7. to explore how your app directories are structured `bx cf ssh flask-hello-world`
5965

60-
![ibm_cloud](/img/ibm_cloud.png)
61-
66+
![ibm_cloud](/img/ibm_cloud.png)

app.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
app = Flask(__name__)
44

5-
@app.route('/')
5+
6+
@app.route("/")
67
def index():
78
return "<h1> Welcome Rahul </h1>"
89

9-
@app.route('/<name>/')
10+
11+
@app.route("/<name>/")
1012
def name(name):
1113
return "<h1> Hello, <span style='color:red;'>{} </span> ! </h2>".format(name)
1214

13-
if __name__=='__main__':
14-
app.run(debug=True, host='0.0.0.0')
15+
16+
if __name__ == "__main__":
17+
app.run(debug=True, host="0.0.0.0")

azure-pipelines.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,26 @@
44
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
55

66
trigger:
7-
- main
7+
- main
88

99
pool:
1010
name: boschepoc
1111

1212
variables:
13-
name:
14-
python.version=3.10
13+
name: python.version=3.10
1514

1615
steps:
17-
- task: PowerShell@2
18-
inputs:
19-
targetType: 'inline'
20-
script: |
21-
# Write your PowerShell commands here.
22-
23-
cd C:\Users\srahul\Documents\helloworldtest\flask-hello-world
24-
python -m venv venv C:\Users\srahul\Documents\helloworldtest\flask-hello-world\venv\Scripts\Activate.ps1
25-
python -m pip install --upgrade pip
26-
pip install -r requirements.txt
27-
displayName: 'Install dependencies'
16+
- task: PowerShell@2
17+
inputs:
18+
targetType: "inline"
19+
script: |
20+
# Write your PowerShell commands here.
2821
29-
- script:
30-
START /B python api.py > webapp.txt
31-
displayName: 'run app.py'
22+
cd C:\Users\srahul\Documents\helloworldtest\flask-hello-world
23+
python -m venv venv C:\Users\srahul\Documents\helloworldtest\flask-hello-world\venv\Scripts\Activate.ps1
24+
python -m pip install --upgrade pip
25+
pip install -r requirements.txt
26+
displayName: "Install dependencies"
27+
28+
- script: START /B python api.py > webapp.txt
29+
displayName: "run app.py"

manifest.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
applications:
2-
- path: .
3-
# host: flask-hello-world
4-
random_route: True
5-
name: flask-hello-world
6-
domaine: mybluemix.net
7-
memory: 128M
8-
disk_quota: 128M
9-
10-
2+
- path: .
3+
# host: flask-hello-world
4+
random_route: True
5+
name: flask-hello-world
6+
domaine: mybluemix.net
7+
memory: 128M
8+
disk_quota: 128M

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
flask==1.0.2
2-
gunicorn==19.9.0
1+
flask==2.3.2
2+
gunicorn==20.1.0

setup.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
here = path.abspath(path.dirname(__file__))
1313

1414
# Get the long description from the README file
15-
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
15+
with open(path.join(here, "README.md"), encoding="utf-8") as f:
1616
long_description = f.read()
1717

1818
setup(
19-
name='flask-hello-world',
20-
version='1.0.0',
21-
description='Hello World app for running Python apps on Bluemix',
19+
name="flask-hello-world",
20+
version="1.0.0",
21+
description="Hello World app for running Python apps on Bluemix",
2222
long_description=long_description,
23-
url='https://github.com/AhmNouira/flask-hello-world',
24-
author= 'Ahmed Nouira',
25-
author_email= '[email protected]',
26-
license='MIT',
27-
keywords= ['flask', 'hello world'],
28-
install_requires= ['flask', 'gunicorn'],
29-
include_package_data= True,
30-
zip_safe= True,
31-
#entry_points="""[boot.sh]"""
23+
url="https://github.com/AhmNouira/flask-hello-world",
24+
author="Ahmed Nouira",
25+
author_email="[email protected]",
26+
license="MIT",
27+
keywords=["flask", "hello world"],
28+
install_requires=["flask", "gunicorn"],
29+
include_package_data=True,
30+
zip_safe=True,
31+
# entry_points="""[boot.sh]"""
3232
)

0 commit comments

Comments
 (0)