From 21a850a9d44c8fbe95c2ab6f7f2c68cb58461099 Mon Sep 17 00:00:00 2001 From: dj Date: Thu, 5 Nov 2026 20:35:16 +0000 Subject: [PATCH] init --- README.md | 3 +++ app.py | 10 ++++++++++ requirements.txt | 1 + scripts/after_install.sh | 2 ++ scripts/before_install.sh | 3 +++ scripts/start_application.sh | 3 +++ setup.py | 8 ++++++++ templates/index.html | 11 +++++++++++ tests/test_ap.py | 11 +++++++++++ 9 files changed, 52 insertions(+) create mode 100644 README.md create mode 100644 app.py create mode 100644 requirements.txt create mode 100644 scripts/after_install.sh create mode 100644 scripts/before_install.sh create mode 100644 scripts/start_application.sh create mode 100644 setup.py create mode 100644 templates/index.html create mode 100644 tests/test_ap.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..7f55116 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Sample Flask Web App + +This is a simple Flask application. \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..2dc61d0 --- /dev/null +++ b/app.py @@ -0,0 +1,10 @@ +from flask import Flask, render_template + +app = Flask(__name__) + +@app.route('/') +def home(): + return render_template('index.html') + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=80) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2077213 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Flask \ No newline at end of file diff --git a/scripts/after_install.sh b/scripts/after_install.sh new file mode 100644 index 0000000..75d439c --- /dev/null +++ b/scripts/after_install.sh @@ -0,0 +1,2 @@ +#!/bin/bash +pip3 install -r /var/www/html/sample-web-app/requirements.txt \ No newline at end of file diff --git a/scripts/before_install.sh b/scripts/before_install.sh new file mode 100644 index 0000000..8c81fcd --- /dev/null +++ b/scripts/before_install.sh @@ -0,0 +1,3 @@ +#!/bin/bash +sudo yum update -y +sudo yum install -y python3 python3-pip \ No newline at end of file diff --git a/scripts/start_application.sh b/scripts/start_application.sh new file mode 100644 index 0000000..1427295 --- /dev/null +++ b/scripts/start_application.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd /var/www/html/sample-web-app +sudo python3 app.py > app.log 2>&1 & \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6623909 --- /dev/null +++ b/setup.py @@ -0,0 +1,8 @@ +from setuptools import setup, find_packages + +setup( + name='sample-web-app', + version='1.0', + packages=find_packages(), + install_requires=['Flask'], +) \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..8dabbf1 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,11 @@ + + + + + + Flask App + + +

Welcome to Flask!

+ + \ No newline at end of file diff --git a/tests/test_ap.py b/tests/test_ap.py new file mode 100644 index 0000000..2e450ba --- /dev/null +++ b/tests/test_ap.py @@ -0,0 +1,11 @@ +import unittest +from app import app + +class FlaskTestCase(unittest.TestCase): + def test_home(self): + tester = app.test_client(self) + response = tester.get('/') + self.assertEqual(response.status_code, 200) + +if __name__ == '__main__': + unittest.main() \ No newline at end of file