diff --git a/app_python/README.md b/app_python/README.md new file mode 100644 index 000000000..10fe0e7c5 --- /dev/null +++ b/app_python/README.md @@ -0,0 +1,12 @@ +# Current Time in Moscow + +## Overview +This is a simple Python web application that displays the current time in Moscow. It uses the Flask web framework and the datetime module to get the current time in the Europe/Moscow timezone. The time is displayed in a user-friendly format on a web page. + +## Build +To build this application, you need to create a Python file with a main.py extension, for example, app.py. Then, copy the code in main.py to your file. Save the file and run it using the command python app.py in a terminal or command prompt. +The application will start running on your local machine. + +## Usage +To use the application, open a web browser and navigate to http://localhost:5000/. The current time in Moscow will be displayed on the web page. The time will be updated every time you refresh the page. + diff --git a/app_python/main.py b/app_python/main.py new file mode 100644 index 000000000..00c8b1f82 --- /dev/null +++ b/app_python/main.py @@ -0,0 +1,17 @@ +from datetime import datetime + +from flask import Flask + +app = Flask(__name__) + +def get_current_time(): + now = datetime.now() + current_time = now.strftime("Current Time in Moscow: %Y-%m-%d %H:%M:%S") + return current_time + +@app.route('/') +def home(): + return get_current_time() + +if __name__ == '__main__': + app.run(host="0.0.0.0", debug=True) \ No newline at end of file diff --git a/app_python/requirements.txt b/app_python/requirements.txt new file mode 100644 index 000000000..496a52930 --- /dev/null +++ b/app_python/requirements.txt @@ -0,0 +1,2 @@ +pytz +Flask==2.0.1