Skip to content

mari1647iv/devops

Repository files navigation

CI Docker Issues Contributors MIT License

Moscow Time - Python Web Application

Table of Contents

About

Simple Python web application, that shows current time in Moscow. The time updates with a page refreshing. This project was developed within the DevOps Engineering course in Innopolis University. The Flask framework was used to adapt the python code to web app. More about best practices used you can read in PYTHON.md in app_python folder.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Download the project using

git clone https://github.com/mari1647iv/devops.git

Set up the environment using setup.py:

python3 -m venv venv

source venv/bin/activate

pip install .

or install the requirements manually:

python3 -m venv venv

source venv/bin/activate

python3 -m pip install -r app_python/requirements.txt

Installation

Start the application:

cd app_python
python3 main.py

As a result you will get the project running on your localhost with port 5000

 * Serving Flask app "main" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 830-674-667

Docker

The application could be built and running using Docker.

Download the project using

git clone https://github.com/mari1647iv/devops.git

Build docker image:

cd app_python
docker build --tag mari1647iv/devops:app_python .

or pull it from the Docker Hub repository:

docker pull mari1647iv/devops:app_python

Run the docker image

docker run -p 5000:5000 mari1647iv/devops:app_python

To run it in detached mode use:

docker run -d -p 5000:5000 mari1647iv/devops:app_python

Usage

The application is running locally on port 5000. The web pages demonstrates the current time in Moscow. As the page is refreshed the time updates correspondingly.

Press CTRL+C in terminal to stop the application.

Do not forget to leave the virtual environment:

cd ..
deactivate

Endpoints

  • / - root path with current Moscow time
  • /visits - list of the root path / visits by the client.

Unit Tests

Unit tests are written in python using unittest framework and stored in test_main.py file.

To run the tests you can use the following command in the app_python folder:

python3 -m unittest test_main.py

Author

Marina Ivanova, Innopolis University BS18-SE-01

Project Link: https://github.com/mari1647iv/devops

License

Distributed under the MIT License. See LICENSE.md for more information.

About

DevOps Engineering course project

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published