Skip to content

Commit ce0a08d

Browse files
committed
26 days
1 parent 784fc87 commit ce0a08d

File tree

12 files changed

+705
-2175
lines changed

12 files changed

+705
-2175
lines changed

Diff for: pandas.ipynb

-2,175
This file was deleted.

Diff for: python_for_web/.gitignore

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# celery beat schedule file
95+
celerybeat-schedule
96+
97+
# SageMath parsed files
98+
*.sage.py
99+
100+
# Environments
101+
.env
102+
.venv
103+
env/
104+
venv/
105+
ENV/
106+
env.bak/
107+
venv.bak/
108+
109+
# Spyder project settings
110+
.spyderproject
111+
.spyproject
112+
113+
# Rope project settings
114+
.ropeproject
115+
116+
# mkdocs documentation
117+
/site
118+
119+
# mypy
120+
.mypy_cache/
121+
.dmypy.json
122+
dmypy.json
123+
124+
# Pyre type checker
125+
.pyre/

Diff for: python_for_web/Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: python app.py

Diff for: python_for_web/app.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# let's import the flask
2+
from flask import Flask, render_template, request, redirect, url_for
3+
import os # importing operating system module
4+
5+
app = Flask(__name__)
6+
7+
@app.route('/') # this decorator create the home route
8+
def home ():
9+
techs = ['HTML', 'CSS', 'Flask', 'Python']
10+
name = '30 Days Of Python Programming'
11+
return render_template('home.html', techs=techs, name = name, title = 'Home')
12+
13+
@app.route('/about')
14+
def about():
15+
name = '30 Days Of Python Programming'
16+
return render_template('about.html', name = name, title = 'About Us')
17+
18+
@app.route('/post', methods= ['GET','POST'])
19+
def post():
20+
name = 'Text Analyzer'
21+
return render_template('post.html', name = name, title = name)
22+
23+
24+
if __name__ == '__main__':
25+
# for deployment
26+
# to make it work for both production and development
27+
port = int(os.environ.get("PORT", 5000))
28+
app.run(debug=True, host='0.0.0.0', port=port)

Diff for: python_for_web/requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Click==7.0
2+
Flask==1.1.1
3+
itsdangerous==1.1.0
4+
Jinja2==2.10.3
5+
MarkupSafe==1.1.1
6+
Werkzeug==0.16.0

Diff for: python_for_web/static/css/main.css

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
box-sizing: border-box;
5+
}
6+
7+
:root {
8+
--header-bg-color: #4a7799;
9+
--textarea-bg-color: rgb(235, 231, 231);
10+
--body-bg-color: rgb(225, 228, 230);
11+
--nav-link-color:#aaa;
12+
}
13+
14+
body {
15+
background: var(--body-bg-color);
16+
margin: auto;
17+
line-height: 1.5;
18+
}
19+
20+
header {
21+
background: var(--header-bg-color);
22+
}
23+
24+
h1,
25+
h2 {
26+
margin: 25px;
27+
}
28+
29+
.menu-container {
30+
width: 90%;
31+
display: flex;
32+
justify-content: space-around;
33+
align-items: center;
34+
color: rgb(221, 215, 215);
35+
padding: 25px;
36+
}
37+
38+
.nav-lists {
39+
display: flex;
40+
}
41+
42+
li {
43+
list-style: none;
44+
}
45+
46+
.nav-list {
47+
list-style: none;
48+
margin: 0 5px;
49+
}
50+
51+
.nav-link {
52+
text-decoration: none;
53+
font-size: 22px;
54+
padding: 0 5px;
55+
color: var(--nav-link-color);
56+
}
57+
58+
main {
59+
width: 90%;
60+
margin: auto;
61+
text-align: center;
62+
}
63+
64+
.btn{
65+
width: 150px;
66+
height: 50px;
67+
background: var(--header-bg-color);
68+
color: var(--nav-link-color);
69+
font-size: 20px;
70+
margin:5px;
71+
border: 1px solid var(--header-bg-color);
72+
}
73+
74+
.btn:focus {
75+
outline: 2px solid #2a70a5;
76+
}
77+
78+
79+
textarea {
80+
padding: 20px;
81+
outline: 1px solid var(--nav-link-color);
82+
border: none;
83+
font-size: 18px;
84+
}
85+
86+
textarea:focus {
87+
border: none;
88+
outline: 2px solid #4a7799;
89+
background: var(--textarea-bg-color);
90+
font-size: 18px;
91+
}

Diff for: python_for_web/templates/about.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% extends 'layout.html' %}
2+
{% block content %}
3+
<h1>About Us</h1>
4+
<h2>{{name}}</h2>
5+
<p>This is a 30 days of python programming challenge. If you have been coding this far, you are awesome. Congratulations
6+
for the job well done!</p>
7+
{% endblock %}

Diff for: python_for_web/templates/home.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% extends 'layout.html' %}
2+
{% block content %}
3+
<h1>Welcome to {{name}}</h1>
4+
<p>You need the following technologies to build this web application:</p>
5+
<ul>
6+
{% for tech in techs %}
7+
<li>{{tech}}</li>
8+
9+
{% endfor %}
10+
</ul>
11+
{% endblock %}

Diff for: python_for_web/templates/layout.html

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
8+
{% if title %}
9+
<title>30 Days of Python - {{ title}}</title>
10+
{% else %}
11+
<title>30 Days of Python</title>
12+
{% endif %}
13+
</head>
14+
15+
<body>
16+
<header>
17+
<div class="menu-container">
18+
<div>
19+
<a class="nav-link" href="/">30DaysOfPython</a>
20+
</div>
21+
<ul class="nav-lists">
22+
<li class="nav-list"><a class="nav-link" href="{{ url_for('home') }}">Home</a></li>
23+
<li class="nav-list"><a class="nav-link" href="{{ url_for('about') }}">About</a></li>
24+
<li class="nav-list"><a class="nav-link" href="{{ url_for('post') }}">Text Analyzer</a></li>
25+
</ul>
26+
</div>
27+
28+
29+
</header>
30+
<main>
31+
{% block content %} {% endblock %}
32+
</main>
33+
</body>
34+
35+
</html>

Diff for: python_for_web/templates/post.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% extends 'layout.html' %}
2+
{% block content %}
3+
<h1>Text Analyzer</h1>
4+
<form action="result.html" method="POST"></form>
5+
<textarea cols="120" rows='30' name="content"></textarea>
6+
<br />
7+
<input type='submit' class="btn" value="Process Text"/>
8+
</form>
9+
{% endblock %}

Diff for: python_for_web/templates/result.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% extends 'layout.html' %}
2+
{% block content %}
3+
<h1>Result </h1>
4+
5+
{% endblock %}

0 commit comments

Comments
 (0)