Skip to content

Commit 85fca9f

Browse files
committed
cleanup
1 parent dd6295f commit 85fca9f

File tree

15 files changed

+89
-375
lines changed

15 files changed

+89
-375
lines changed

Pipfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@ python-dotenv="*"
99
[packages]
1010
flask="*"
1111
flask_assets="*"
12-
flask_redis="*"
13-
flask_sqlalchemy="*"
1412
pathlib="*"
1513
dash="*"
1614
dash_core_components="*"
1715
dash_html_components="*"
1816
dash-renderer="*"
1917
pandas="*"
2018
lesscpy="*"
21-
psycopg2-binary="*"
2219
cssmin="*"
2320
jsmin="*"
2421

Pipfile.lock

Lines changed: 16 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
# plotlydash-flask-tutorial
1+
# Plot.ly Dash Flask Tutorial
2+
3+
4+
![Python](https://img.shields.io/badge/Python-3.7.2-blue.svg?logo=python&longCache=true&logoColor=white&colorB=23a8e2&style=flat-square&colorA=36363e)
5+
![Flask](https://img.shields.io/badge/flask-1.0.2-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=23a8e2&colorA=36363e)
6+
![Flask-Assets](https://img.shields.io/badge/flask--assets-v0.12-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=23a8e2&colorA=36363e)
7+
![Pandas](https://img.shields.io/badge/pandas-v0.24.2-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=23a8e2&colorA=36363e)
8+
![Dash](https://img.shields.io/badge/dash-v0.40.0-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=23a8e2&colorA=36363e)
9+
![Plotly](https://img.shields.io/badge/plotly-v3.7.1-blue.svg?longCache=true&logo=python&longCache=true&style=flat-square&logoColor=white&colorB=23a8e2&colorA=36363e)
10+
![GitHub Last Commit](https://img.shields.io/github/last-commit/google/skia.svg?style=flat-square&colorA=36363e)
11+
[![GitHub Issues](https://img.shields.io/github/issues/toddbirchard/plotlydash-flask-tutorial.svg?style=flat-square&colorA=36363e)](https://github.com/toddbirchard/plotlydash-flask-tutorial/issues)
12+
[![GitHub Stars](https://img.shields.io/github/stars/toddbirchard/plotlydash-flask-tutorial.svg?style=flat-square&colorB=e3bb18&colorA=36363e)](https://github.com/toddbirchard/plotlydash-flask-tutorial/stargazers)
13+
[![GitHub Forks](https://img.shields.io/github/forks/toddbirchard/plotlydash-flask-tutorial.svg?style=flat-square&colorA=36363e)](https://github.com/toddbirchard/plotlydash-flask-tutorial/network)
14+
15+
16+
Source code for the accompanying tutorial found here: https://hackersandslackers.com/gaining-full-control-over-plotly-dash/

plotly_flask_tutorial/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
from flask import Flask
2-
from . import plotly_dash_views
2+
from . import dash_view
33

44

55
def create_app():
66
"""Construct the core application."""
77
app = Flask(__name__, instance_relative_config=False)
88
app.config.from_object('config.Config')
9-
dash_app = plotly_dash_views.dataframes.Add_Dash(app)
9+
dash_app = dash_view.Add_Dash(app)
1010

1111
with app.app_context():
1212

1313
# Construct the data set
1414
from . import routes
1515
app.register_blueprint(routes.main_bp)
16-
# app.register_blueprint(plotly_dash_views.routes.plotly_bp)
1716

1817
return app

plotly_flask_tutorial/plotly_dash_views/dataframes.py renamed to plotly_flask_tutorial/dash_view.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010

1111

1212
def Add_Dash(server):
13-
"""Populates page with previews of datasets."""
14-
external_stylesheets = ['https://hackers.nyc3.cdn.digitaloceanspaces.com/css/plotly-flask-tutorial8.css',
13+
"""Plot.ly Dash view which populates the screen with loaded DataFrames."""
14+
external_stylesheets = ['https://hackers.nyc3.cdn.digitaloceanspaces.com/css/plotly-flask-tutorial.css',
1515
'https://fonts.googleapis.com/css?family=Lato',
1616
'https://use.fontawesome.com/releases/v5.8.1/css/all.css']
1717
dash_app = Dash(server=server,
18-
url_base_pathname='/plotly_dash_views/',
19-
external_stylesheets=external_stylesheets)
18+
external_stylesheets=external_stylesheets,
19+
routes_pathname_prefix='/dash_view/')
20+
21+
# Override the underlying HTML template
2022
dash_app.index_string = '''<!DOCTYPE html>
2123
<html>
2224
<head>
@@ -28,7 +30,7 @@ def Add_Dash(server):
2830
<body>
2931
<nav>
3032
<a href="/"><i class="fas fa-home"></i> Home</a>
31-
<a href="/plotly_dash_views/"><i class="fas fa-chart-line"></i> Embdedded Plotly Dash</a>
33+
<a href="/dash_view/"><i class="fas fa-chart-line"></i> Embdedded Plotly Dash</a>
3234
</nav>
3335
{%app_entry%}
3436
<footer>
@@ -39,8 +41,7 @@ def Add_Dash(server):
3941
</body>
4042
</html>'''
4143

42-
43-
# Create layout
44+
# Create Dash Layout comprised of Data Tables
4445
dash_app.layout = html.Div(
4546
children=get_datasets(),
4647
id='flex-container'
@@ -50,8 +51,8 @@ def Add_Dash(server):
5051

5152

5253
def get_datasets():
53-
"""Gets all CSVs in /data directory."""
54-
data_filepath = list(p.glob('plotly_flask_tutorial/plotly_dash_views/data/*.csv'))
54+
"""Returns previews of all CSVs saved in /data directory."""
55+
data_filepath = list(p.glob('plotly_flask_tutorial/data/*.csv'))
5556
arr = ['This is an example Plot.ly Dash App.']
5657
for index, csv in enumerate(data_filepath):
5758
print(PurePath(csv))

plotly_flask_tutorial/plotly_dash_views/__init__.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

plotly_flask_tutorial/plotly_dash_views/templates/index.html

Lines changed: 0 additions & 19 deletions
This file was deleted.

plotly_flask_tutorial/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Environment.debug = False
1313
less_bundle = Bundle('less/*.less',
1414
filters='less,cssmin',
15-
output='dist/css/style.css',
15+
output='dist/css/plotly-flask-tutorial.css.css',
1616
extra={'rel': 'stylesheet/less'})
1717
js_bundle = Bundle('js/*.js',
1818
filters='jsmin',

0 commit comments

Comments
 (0)