-
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
0 parents
commit 31084c2
Showing
5 changed files
with
66 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Ignore specific files | ||
.env | ||
|
||
# Ignore IDE files and folders | ||
.idea | ||
.vscode | ||
|
||
# Ignore python dependencies and out dir's | ||
__pycache__ | ||
__pycache__/* | ||
.venv | ||
.venv/* | ||
.conda | ||
.conda/* | ||
|
||
# Ignore py out files | ||
*.pyo | ||
*.pyd |
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 @@ | ||
# flask-github-actions-demo |
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,21 @@ | ||
from flask import Flask | ||
from dotenv import load_dotenv | ||
import os | ||
|
||
load_dotenv() | ||
|
||
app = Flask(__name__) | ||
|
||
|
||
@app.route('/<random_string>') | ||
def return_backwards_string(random_string): | ||
return "".join(reversed(random_string)) | ||
|
||
|
||
@app.route('/get-mode') | ||
def get_mode(): | ||
return os.environ.get("MODE") | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0', port=8080) |
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,17 @@ | ||
from main import return_backwards_string, get_mode | ||
import unittest | ||
import os | ||
|
||
|
||
class TestMain(unittest.TestCase): | ||
def test_return_backwards_string(self): | ||
random_string = "This is my test string" | ||
random_string_reversed = random_string[::-1] | ||
self.assertEqual(random_string_reversed, return_backwards_string(random_string)) | ||
|
||
def test_get_env(self): | ||
self.assertEqual(os.environ.get("MODE"), get_mode()) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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,9 @@ | ||
blinker==1.9.0 | ||
click==8.1.7 | ||
colorama==0.4.6 | ||
Flask==3.1.0 | ||
itsdangerous==2.2.0 | ||
Jinja2==3.1.4 | ||
MarkupSafe==3.0.2 | ||
python-dotenv==1.0.1 | ||
Werkzeug==3.1.3 |