-
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
1 parent
b79aa4c
commit 88730f0
Showing
4 changed files
with
48 additions
and
16 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
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
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 |
---|---|---|
@@ -1,10 +1,41 @@ | ||
from flask import Flask | ||
from flask import ( | ||
Flask, | ||
request, | ||
render_template_string, | ||
) | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
HTML_TEMPLATE = """ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Movie Request Form</title> | ||
</head> | ||
<body> | ||
<h1>Enter Your Details</h1> | ||
<form method="POST" action="/"> | ||
<label for="name">Name:</label> | ||
<input type="text" id="name" name="name" required><br><br> | ||
<label for="genre">Genre:</label> | ||
<input type="text" id="genre" name="genre" required><br><br> | ||
<label for="mood">Mood:</label> | ||
<input type="text" id="mood" name="mood" required><br><br> | ||
<button type="submit">Submit</button> | ||
</form> | ||
</body> | ||
</html> | ||
""" | ||
|
||
@app.route('/', methods=["GET", "POST"]) | ||
|
||
def hello_world(): | ||
return 'Hello, World!' | ||
if request.method == "POST": | ||
return f"<h1>Hello World!</h1>" | ||
return render_template_string(HTML_TEMPLATE) | ||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0', port=5000) | ||
app.run(host='0.0.0.0', port=5000, debug=True) |
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 |
---|---|---|
|
@@ -3,4 +3,6 @@ pytest | |
pytest-cov | ||
pylint | ||
ruff | ||
Flask==2.0.1 | ||
Flask==2.0.1 | ||
Werkzeug==2.0.1 | ||
python-dotenv |