Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9d42b4

Browse files
authored
Add files via upload
1 parent 3b2cd17 commit c9d42b4

File tree

16 files changed

+417
-0
lines changed

16 files changed

+417
-0
lines changed

python-flask-templates/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)

python-flask-templates/main.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from app import app
2+
from flask import render_template
3+
from datetime import datetime
4+
5+
@app.context_processor
6+
def inject_now():
7+
return {'now': datetime.utcnow()}
8+
9+
@app.route('/')
10+
def home():
11+
return render_template('index.html')
12+
13+
@app.route('/about')
14+
def about():
15+
return render_template('about.html')
16+
17+
@app.route('/testimonials')
18+
def testimonials():
19+
return render_template('testimonials.html')
20+
21+
@app.route('/contact')
22+
def contact():
23+
return render_template('contact.html')
24+
25+
@app.route('/products')
26+
def products():
27+
return render_template('products.html')
28+
29+
if __name__ == "__main__":
30+
app.run()

python-flask-templates/readme.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You can read tutorial at https://www.roytuts.com/working-with-parent-and-child-templates-in-flask/
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/* Style inputs with type="text", select elements and textareas */
2+
input[type=text], select, textarea {
3+
width: 100%; /* Full width */
4+
padding: 12px; /* Some padding */
5+
border: 1px solid #ccc; /* Gray border */
6+
border-radius: 4px; /* Rounded borders */
7+
box-sizing: border-box; /* Make sure that padding and width stays in place */
8+
margin-top: 6px; /* Add a top margin */
9+
margin-bottom: 16px; /* Bottom margin */
10+
resize: vertical /* Allow the user to vertically resize the textarea (not horizontally) */
11+
}
12+
13+
/* Style the submit button with a specific background color etc */
14+
input[type=submit] {
15+
background-color: #66ccff;
16+
color: #000000;
17+
padding: 12px 20px;
18+
border: none;
19+
border-radius: 4px;
20+
cursor: pointer;
21+
}
22+
23+
/* When moving the mouse over the submit button, add a darker green color */
24+
input[type=submit]:hover {
25+
background-color:#0099cc;
26+
}
27+
28+
/* Add a background color and some padding around the form */
29+
.container {
30+
border-radius: 5px;
31+
background-color: #000000;
32+
padding: 20px;
33+
}
Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
* {
2+
box-sizing: border-box;
3+
}
4+
5+
.row::after {
6+
content: "";
7+
clear: both;
8+
display: table;
9+
}
10+
11+
[class*="col-"] {
12+
float: left;
13+
padding: 15px;
14+
}
15+
16+
html {
17+
font-family: "Lucida Sans", sans-serif;
18+
}
19+
20+
.header {
21+
background-color: #66ccff;
22+
color: #000000;
23+
padding: 15px;
24+
height: 75px;
25+
}
26+
.header-links{
27+
padding:4px !important;
28+
}
29+
30+
.menu-ul {
31+
list-style-type: none;
32+
margin: 0;
33+
padding: 0;
34+
color: #000000;
35+
36+
}
37+
38+
.menu-li {
39+
padding: 8px;
40+
margin-bottom: 7px;
41+
background-color: #66ccff;
42+
color: #000000;
43+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
44+
}
45+
46+
.menu-li:hover {
47+
background-color: #0099cc;
48+
}
49+
50+
.menu-li a{
51+
text-decoration:none !important;
52+
color: #000000;
53+
}
54+
55+
.aside {
56+
background-color: #33b5e5;
57+
padding: 15px;
58+
color: #000000;
59+
text-align: center;
60+
font-size: 14px;
61+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
62+
}
63+
64+
.footer {
65+
background-color: #66ccff;
66+
color: #000000;
67+
text-align: center;
68+
font-size: 12px;
69+
padding: 15px;
70+
position: absolute;
71+
bottom: 0;
72+
width: 100%;
73+
height: 60px;
74+
/* Height of the footer */
75+
}
76+
77+
/* For mobile phones: */
78+
[class*="col-"] {
79+
width: 100%;
80+
}
81+
82+
@media only screen and (min-width: 600px) {
83+
84+
/* For tablets: */
85+
.col-s-1 {
86+
width: 8.33%;
87+
}
88+
89+
.col-s-2 {
90+
width: 16.66%;
91+
}
92+
93+
.col-s-3 {
94+
width: 25%;
95+
}
96+
97+
.col-s-4 {
98+
width: 33.33%;
99+
}
100+
101+
.col-s-5 {
102+
width: 41.66%;
103+
}
104+
105+
.col-s-6 {
106+
width: 50%;
107+
}
108+
109+
.col-s-7 {
110+
width: 58.33%;
111+
}
112+
113+
.col-s-8 {
114+
width: 66.66%;
115+
}
116+
117+
.col-s-9 {
118+
width: 75%;
119+
}
120+
121+
.col-s-10 {
122+
width: 83.33%;
123+
}
124+
125+
.col-s-11 {
126+
width: 91.66%;
127+
}
128+
129+
.col-s-12 {
130+
width: 100%;
131+
}
132+
133+
.hamburger {
134+
display: block;
135+
}
136+
137+
}
138+
139+
@media only screen and (min-width: 768px) {
140+
141+
/* For desktop: */
142+
.col-1 {
143+
width: 8.33%;
144+
}
145+
146+
.col-2 {
147+
width: 16.66%;
148+
}
149+
150+
.col-3 {
151+
width: 25%;
152+
}
153+
154+
.col-4 {
155+
width: 33.33%;
156+
}
157+
158+
.col-5 {
159+
width: 41.66%;
160+
}
161+
162+
.col-6 {
163+
width: 50%;
164+
}
165+
166+
.col-7 {
167+
width: 58.33%;
168+
}
169+
170+
.col-8 {
171+
width: 66.66%;
172+
}
173+
174+
.col-9 {
175+
width: 75%;
176+
}
177+
178+
.col-10 {
179+
width: 83.33%;
180+
}
181+
182+
.col-11 {
183+
width: 91.66%;
184+
}
185+
186+
.col-12 {
187+
width: 100%;
188+
}
189+
}
190+
191+
.navbar {
192+
height: 60px;
193+
width: 100%;
194+
background-color: #FF4E00;
195+
}
196+
197+
span {
198+
display: block;
199+
color: white;
200+
text-align: center;
201+
float: left;
202+
padding: 14px 16px
203+
}
204+
205+
ul {
206+
list-style-type: none;
207+
margin: 0;
208+
padding: 0;
209+
overflow: hidden;
210+
}
211+
212+
li {
213+
float: left;
214+
}
215+
216+
li a {
217+
display: block;
218+
color: black;
219+
text-align: center;
220+
padding: 14px 16px;
221+
text-decoration: none;
222+
}
223+
224+
li a:hover {
225+
color: black;
226+
cursor: pointer
227+
}
228+
229+
@media screen and (max-width: 600px) {
230+
.header-links {
231+
display: none;
232+
}
233+
234+
.hamburger {
235+
display: block;
236+
}
237+
238+
.footer {
239+
position: relative;
240+
}
241+
242+
}
Loading
67 KB
Loading
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "parent.html" %}
2+
{% block title %}About Us{% endblock %}
3+
{% block content %}
4+
<h1>About Us</h1>
5+
<p>
6+
This is about us page.
7+
</p>
8+
{% endblock %}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{% extends "parent.html" %}
2+
{% block title %}Contact Us{% endblock %}
3+
{% block head %}
4+
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/contact.css') }}"/>
5+
{% endblock %}
6+
{% block content %}
7+
<script>
8+
function fnSubmit(){
9+
document.getElementById("SuccessMsg").style.display = "block";
10+
return false;
11+
}
12+
</script>
13+
14+
<div style="text-align:center">
15+
<h1>Contact Us</h1>
16+
<p>Use the form below to leave us a message:</p>
17+
</div>
18+
19+
<div class="row">
20+
<div class="column">
21+
</div>
22+
<div class="column">
23+
<label for="fname">Name</label>
24+
<input type="text" id="name" name="name" placeholder="Your name..">
25+
<label for="message">Your Message</label>
26+
<textarea id="message" name="message" placeholder="Write something.." style="height:100px"></textarea>
27+
<label id="SuccessMsg" style="color:green; display:none"><strong>Form Submitted Successfully!</strong></label>
28+
<input type="submit" value="Submit" onclick="javascript:fnSubmit()" />
29+
</div>
30+
</div>
31+
{% endblock %}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "parent.html" %}
2+
{% block title %}Welcome{% endblock %}
3+
{% block content %}
4+
<h1>Welcome</h1>
5+
<p>
6+
Welcome to working with parent and child templates in flask
7+
</p>
8+
{% endblock %}

0 commit comments

Comments
 (0)