init
This commit is contained in:
@@ -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)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Flask
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
pip3 install -r /var/www/html/sample-web-app/requirements.txt
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sudo yum update -y
|
||||||
|
sudo yum install -y python3 python3-pip
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd /var/www/html/sample-web-app
|
||||||
|
sudo python3 app.py > app.log 2>&1 &
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name='sample-web-app',
|
||||||
|
version='1.0',
|
||||||
|
packages=find_packages(),
|
||||||
|
install_requires=['Flask'],
|
||||||
|
)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Flask App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Welcome to Flask!</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -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()
|
||||||
Reference in New Issue
Block a user