-
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.
Merge pull request #3 from Kaister300/python-flask-server
Added Python Flask Server
- Loading branch information
Showing
4 changed files
with
50 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
python-dotenv | ||
python-dotenv | ||
flask |
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,28 @@ | ||
""" | ||
Basic Flask server to serve webpage. | ||
""" | ||
|
||
from flask import Flask | ||
|
||
HOSTADDR = "localhost" | ||
PORT = 3124 | ||
|
||
app = Flask(__name__, static_folder="webpage", static_url_path="") | ||
app.config.from_object(__name__) | ||
|
||
|
||
@app.route("/", methods=["GET"]) | ||
def main_page(): | ||
""" | ||
Returns the main page of the application. | ||
This function sends the static file "index.html" as the main page of the application. | ||
Returns: | ||
str: The content of the "index.html" file. | ||
""" | ||
return app.send_static_file("index.html") | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run(host=HOSTADDR, port=PORT, 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