Skip to content

Commit 916f205

Browse files
author
Sean McIlroy
committed
putting the basics for the site in place
1 parent cfdd180 commit 916f205

File tree

10 files changed

+272
-1
lines changed

10 files changed

+272
-1
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# News Site
2+
3+
## Deploy to aws with Zappa
4+
5+
[Set up your aws cli](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html):
6+
7+
```bash
8+
pip install awscli
9+
aws config
10+
```
11+
12+
Set up your virtual environemnt:
13+
14+
```bash
15+
pip install virtualenv
16+
cd /project/dir
17+
virtualenv --python=python3 venv
18+
```
19+
20+
Deploy or update the site:
21+
22+
```bash
23+
source venv/bin/activate
24+
pip install -r requirements.txt
25+
zappa deploy prod
26+
zappa update prod
27+
```
28+
29+
Deploy under your [Route53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html) domain and [ACM](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html) cert:
30+
31+
Update these lines in zappa_settings.json:
32+
33+
```javascript
34+
"domain": "themcilroy.com",
35+
"certificate_arn": "arn:aws:acm:us-east-1:824269988929:certificate/a029b88f-a7f8-40a4-bd09-3a49787d4c73"
36+
```
37+
38+
Deploy your cert (this takes awhile to propigate):
39+
> zappa certify
40+
41+
Tear it all down with:
42+
> zappa undeploy

index.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from flask import Flask, render_template, request
2+
3+
app = Flask(__name__)
4+
5+
6+
@app.route("/", methods=['GET', 'POST'])
7+
def pagecreate():
8+
return render_template('index.html')
9+
10+
if __name__ == "__main__":
11+
app.run(debug=True, host='127.0.0.1')

requirements.txt

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,48 @@
1+
argcomplete==1.9.3
12
beautifulsoup4==4.7.1
3+
boto3==1.9.93
4+
botocore==1.12.93
25
certifi==2018.11.29
6+
cfn-flip==1.1.0.post1
37
chardet==3.0.4
8+
Click==7.0
49
cssselect==1.0.3
10+
docutils==0.14
11+
durationpy==0.5
512
feedfinder2==0.0.4
613
feedparser==5.2.1
14+
Flask==1.0.2
15+
future==0.16.0
16+
hjson==3.0.1
717
idna==2.8
18+
itsdangerous==1.1.0
819
jieba3k==0.35.1
20+
Jinja2==2.10
21+
jmespath==0.9.3
22+
kappa==0.6.0
23+
lambda-packages==0.20.0
924
lxml==4.3.0
25+
MarkupSafe==1.1.0
1026
newspaper3k==0.2.8
1127
nltk==3.4
1228
Pillow==5.4.1
13-
python-dateutil==2.7.5
29+
placebo==0.8.2
30+
python-dateutil==2.6.1
31+
python-slugify==1.2.4
1432
PyYAML==3.13
1533
requests==2.21.0
1634
requests-file==1.4.3
35+
s3transfer==0.2.0
1736
singledispatch==3.4.0.3
1837
six==1.12.0
1938
soupsieve==1.7.3
2039
tinysegmenter==0.3
2140
tldextract==2.2.0
41+
toml==0.10.0
42+
tqdm==4.19.1
43+
troposphere==2.4.2
44+
Unidecode==1.0.23
2245
urllib3==1.24.1
46+
Werkzeug==0.14.1
47+
wsgi-request-logger==0.4.6
48+
zappa==0.47.1
File renamed without changes.
File renamed without changes.

templates/error.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% extends "layout.html" %}
2+
{% block content %}
3+
<div class="text-white">
4+
<h1> NO! <br> Do it again, and do it right this time... </h1>
5+
</div>
6+
{% endblock %}
7+

templates/index.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
{% extends "layout.html" %}
3+
{% block content %}
4+
<div class="row">
5+
<div class="col-4"></div>
6+
<div class="card mt-5">
7+
<div class="card-body">
8+
<form action="/workout" method="post">
9+
<div class="form-group">
10+
11+
<h2>Input Maxes:</h2>
12+
<input type="number" class="form-control" name="msq" placeholder="Max Squat">
13+
<input type="number" class="form-control" name="mbe" placeholder="Max Press">
14+
<input type="number" class="form-control" name="mdl" placeholder="Max Deadlift">
15+
16+
<h2>Volume:</h2>
17+
<div class="form-check">
18+
<input type="radio" class="form-check-input" name="mainliftchoice" value="low" checked>Low</input>
19+
</div>
20+
<div class="form-check">
21+
<input type="radio" class="form-check-input" name="mainliftchoice" value="high">High</input>
22+
</div>
23+
24+
<div>
25+
<button type="submit" value="Submit" class="button btn btn-primary">Submit</button>
26+
</div>
27+
28+
</div>
29+
</form>
30+
</div>
31+
</div>
32+
<div class="col-4"></div>
33+
</div>
34+
{% endblock %}
35+

templates/layout.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Workout Generator</title>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
8+
</head>
9+
10+
<body class="bg-secondary">
11+
<div class="container">
12+
{% block content %}{% endblock %}
13+
</div>
14+
</body>
15+
<footer>
16+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
17+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
18+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
19+
</footer>
20+
</html>

templates/output.html

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{% extends "layout.html" %}
2+
{% block content %}
3+
<div class="text-white">
4+
<h1>Your Workout Program</h1>
5+
<hr>
6+
<h3>Week 1</h3>
7+
<h4>Day 1</h4>
8+
<ul>
9+
{% for line in outputs['week1']['day1'] %}
10+
<li> {{ line }} </li>
11+
{% endfor %}
12+
</ul>
13+
<h4>Day 2</h4>
14+
<ul>
15+
{% for line in outputs['week1']['day2'] %}
16+
<li> {{ line }} </li>
17+
{% endfor %}
18+
</ul>
19+
<h4>Day 3</h4>
20+
<ul>
21+
{% for line in outputs['week1']['day3'] %}
22+
<li> {{ line }} </li>
23+
{% endfor %}
24+
</ul>
25+
26+
<h3>Week 2</h3>
27+
<h4>Day 1</h4>
28+
<ul>
29+
{% for line in outputs['week2']['day1'] %}
30+
<li> {{ line }} </li>
31+
{% endfor %}
32+
</ul>
33+
<h4>Day 2</h4>
34+
<ul>
35+
{% for line in outputs['week2']['day2'] %}
36+
<li> {{ line }} </li>
37+
{% endfor %}
38+
</ul>
39+
<h4>Day 3</h4>
40+
<ul>
41+
{% for line in outputs['week2']['day3'] %}
42+
<li> {{ line }} </li>
43+
{% endfor %}
44+
</ul>
45+
46+
<h3>Week 3</h3>
47+
<h4>Day 1</h4>
48+
<ul>
49+
{% for line in outputs['week3']['day1'] %}
50+
<li> {{ line }} </li>
51+
{% endfor %}
52+
</ul>
53+
<h4>Day 2</h4>
54+
<ul>
55+
{% for line in outputs['week3']['day2'] %}
56+
<li> {{ line }} </li>
57+
{% endfor %}
58+
</ul>
59+
<h4>Day 3</h4>
60+
<ul>
61+
{% for line in outputs['week3']['day3'] %}
62+
<li> {{ line }} </li>
63+
{% endfor %}
64+
</ul>
65+
66+
<h3>Week 4</h3>
67+
<h4>Day 1</h4>
68+
<ul>
69+
{% for line in outputs['week4']['day1'] %}
70+
<li> {{ line }} </li>
71+
{% endfor %}
72+
</ul>
73+
<h4>Day 2</h4>
74+
<ul>
75+
{% for line in outputs['week4']['day2'] %}
76+
<li> {{ line }} </li>
77+
{% endfor %}
78+
</ul>
79+
<h4>Day 3</h4>
80+
<ul>
81+
{% for line in outputs['week4']['day3'] %}
82+
<li> {{ line }} </li>
83+
{% endfor %}
84+
</ul>
85+
86+
<h3>Week 5</h3>
87+
<h4>Day 1</h4>
88+
<ul>
89+
{% for line in outputs['week5']['day1'] %}
90+
<li> {{ line }} </li>
91+
{% endfor %}
92+
</ul>
93+
<h4>Day 2</h4>
94+
<ul>
95+
{% for line in outputs['week5']['day2'] %}
96+
<li> {{ line }} </li>
97+
{% endfor %}
98+
</ul>
99+
<h4>Day 3</h4>
100+
<ul>
101+
{% for line in outputs['week5']['day3'] %}
102+
<li> {{ line }} </li>
103+
{% endfor %}
104+
</ul>
105+
</div>
106+
{% endblock %}

zappa_settings.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"dev": {
3+
"app_function": "index.app",
4+
"aws_region": "us-west-2",
5+
"profile_name": null,
6+
"project_name": "news-site",
7+
"runtime": "python3.6",
8+
"s3_bucket": "zappa-news-site-dev",
9+
"domain": "dev-news.themcilroy.com",
10+
"route53_enabled": true,
11+
"certificate_arn": "arn:aws:acm:us-east-1:824269988929:certificate/fdc01f6c-be49-40b3-afb7-707d085d1042"
12+
},
13+
"prod": {
14+
"app_function": "index.app",
15+
"aws_region": "us-west-2",
16+
"profile_name": null,
17+
"project_name": "news-site",
18+
"runtime": "python3.6",
19+
"s3_bucket": "zappa-news-site-prod",
20+
"domain": "news.themcilroy.com",
21+
"route53_enabled": true,
22+
"certificate_arn": "arn:aws:acm:us-east-1:824269988929:certificate/fdc01f6c-be49-40b3-afb7-707d085d1042"
23+
}
24+
}

0 commit comments

Comments
 (0)