File tree Expand file tree Collapse file tree 4 files changed +27
-6
lines changed Expand file tree Collapse file tree 4 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 1+ web : python reverse_flask.py
Original file line number Diff line number Diff line change 11from flask import Flask , render_template , request
2+ import os
23
34app = Flask (__name__ )
45
6+ app .config ['DEBUG' ] = False
7+
58
69@app .route ('/' )
710def get_string ():
@@ -14,8 +17,4 @@ def reverse_string():
1417 return render_template (
1518 'result.html' ,
1619 result = str_to_reverse [::- 1 ]
17- )
18-
19- if __name__ == '__main__' :
20- app .debug = True
21- app .run ()
20+ )
Original file line number Diff line number Diff line change 1+ # run.py
2+
3+ import os
4+ from project .reverse_flask import app
5+
6+ host = '0.0.0.0'
7+ port = int (os .environ .get ('PORT' , 5000 ))
8+
9+ if app .config ['DEBUG' ] == True :
10+ app .run ()
11+ else :
12+ app .run (host = host , port = port )
Original file line number Diff line number Diff line change 1- __author__ = 'G'
1+ import unittest
2+
3+ from project .reverse_flask import app
4+
5+ class ConfigTest (unittest .TestCase ):
6+ def test_not_in_debug (self ):
7+ self .assertNotEqual (app .config ['DEBUG' ], True )
8+
9+ if __name__ == '__main__' :
10+ unittest .main ()
You can’t perform that action at this time.
0 commit comments