mmumshad / simple-webapp

Simple Web Application
55 stars 505 forks source link

Simple Web Application

This is a simple web application using Python Flask and MySQL database. This is used in the demonstration of development of Ansible Playbooks.

Below are the steps required to get this working on a base linux system.

1. Install all required dependencies

Python and its dependencies

apt-get install -y python python-setuptools python-dev build-essential python-pip python-mysqldb

2. Install and Configure Database

Install MySQL database

apt-get install -y mysql-server mysql-client

3. Start Database Service

4. Install and Configure Web Server

Install Python Flask dependency

pip install flask
pip install flask-mysql

5. Start Web Server

Start web server

FLASK_APP=app.py flask run --host=0.0.0.0

6. Test

Open a browser and go to URL

http://<IP>:5000                            => Welcome
http://<IP>:5000/how%20are%20you            => I am good, how about you?
http://<IP>:5000/read%20from%20database     => JOHN