File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed
appengine/standard_python3/warmup Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change 2020app = Flask (__name__ )
2121
2222
23- @app .route ('/' )
23+ @app .route ("/" )
2424def main ():
25- return 'Hello World!'
25+ """Serves a predefined placeholder string.
2626
27+ Returns:
28+ A predefined string saying 'Hello World!'
29+ """
30+ return "Hello World!"
2731
28- @app .route ('/_ah/warmup' )
32+
33+ @app .route ("/_ah/warmup" )
2934def warmup ():
30- # Handle your warmup logic here, e.g. set up a database connection pool
31- return '' , 200 , {}
35+ """Served stub function returning no content.
36+
37+ Your warmup logic can be implemented here (e.g. set up a database connection pool)
38+
39+ Returns:
40+ An empty string, an HTTP code 200, and an empty object.
41+ """
42+ return "" , 200 , {}
3243
3344
34- if __name__ == ' __main__' :
45+ if __name__ == " __main__" :
3546 # This is used when running locally only. When deploying to Google App
3647 # Engine, a webserver process such as Gunicorn will serve the app. This
3748 # can be configured by adding an `entrypoint` to app.yaml.
38- app .run (host = ' 127.0.0.1' , port = 8080 , debug = True )
49+ app .run (host = " 127.0.0.1" , port = 8080 , debug = True )
3950# [END gae_python3_warmup_app]
4051# [END gae_python38_warmup_app]
Original file line number Diff line number Diff line change @@ -19,14 +19,14 @@ def test_index():
1919 main .app .testing = True
2020 client = main .app .test_client ()
2121
22- r = client .get ('/' )
22+ r = client .get ("/" )
2323 assert r .status_code == 200
24- assert ' Hello World' in r .data .decode (' utf-8' )
24+ assert " Hello World" in r .data .decode (" utf-8" )
2525
2626
2727def test_warmup ():
2828 main .app .testing = True
2929 client = main .app .test_client ()
3030
31- r = client .get (' /_ah/warmup' )
31+ r = client .get (" /_ah/warmup" )
3232 assert r .status_code == 200
You can’t perform that action at this time.
0 commit comments