Git Product home page Git Product logo

toddbirchard / plotlydash-flask-tutorial Goto Github PK

View Code? Open in Web Editor NEW
478.0 10.0 155.0 1.54 MB

๐Ÿ“Š๐Ÿ“‰ Embed Plotly Dash into your Flask applications.

Home Page: https://hackersandslackers.com/plotly-dash-with-flask/

Python 33.16% Makefile 15.12% Less 34.26% Jinja 17.46%
plotly plotly-dash flask pandas flask-application tutorial data dashboard data-analysis data-visualisation

plotlydash-flask-tutorial's Introduction

Plotly Dash Flask Tutorial

Python Flask Flask-Assets Pandas Dash Plotly GitHub Last Commit GitHub Issues GitHub Stars GitHub Forks

Plotly Dash Tutorial

Make Plotly Dash part of your Flask Application by following this example.

Getting Started

Get set up locally in two steps:

Environment Variables

Replace the values in .env.example with your values and rename this file to .env:

  • FLASK_ENV: The environment in which to run your application; either development or production.
  • SECRET_KEY: Randomly generated string of characters used to encrypt your app's data.
  • LESS_BIN (optional for static assets): Path to your local LESS installation via which lessc.
  • ASSETS_DEBUG (optional): Debug asset creation and bundling in development.
  • LESS_RUN_IN_DEBUG (optional): Debug LESS while in development.
  • COMPRESSOR_DEBUG (optional): Debug asset compression while in development.

Remember never to commit secrets saved in .env files to Github.

Installation

Get up and running with make deploy:

$ git clone https://github.com/hackersandslackers/plotlydash-flask-tutorial.git
$ cd dashboard-flask-tutorial
$ make deploy

Hackers and Slackers tutorials are free of charge. If you found this tutorial helpful, a small donation would be greatly appreciated to keep us in business. All proceeds go towards coffee, and all coffee goes towards more content.

plotlydash-flask-tutorial's People

Contributors

dependabot[bot] avatar imgbotapp avatar mrpaular avatar renovate-bot avatar toddbirchard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plotlydash-flask-tutorial's Issues

Typo: create_dashboard / init_dashboard?

Just ran across the tutorial page, which looks pretty great and is just what I'm wanting to do.

However, I couldn't help but notice that the code-snippet at "keep an eye on what changes" uses create_dashboard ... whereas immediately afterward, all the code blocks use init_dashboard.

In context that surely is just a simple edit/typo, but it's probably worth fixing, lest somebody get confused....

How to access the dash routes

Hey and thanks for your awesome tutorial.
I am trying to use this to add a layer of authenticaion over my dash app, which I hoped I could do by adding a decorator to the route for the dash. but even when hacking dash like this I don't understand how I could do that?

How to add more /dashapp/ views?

Hi, your tutorial is very good! I have a question. Let's say I want to build a view for showing data and it's a different view than the dashboard (/dashapp/) - let's say it goes to /dashapp/summary. How do I do this?

Procfile

How do you config a procfile to run on heroku with the current project configuration?

Run with Poetry on Windows

Hi Todd,
Thanks for the great article. Under poetry shell on Window 10, when I issued poetry run command, I got the message below.

>poetry run
Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: __call__() missing 2 required positional arguments: 'environ' and 'start_response'

Thanks in advance,
Ibrahim

Connection Refused Error

Hi Todd! Thank you very much for this amazing tutorial - this is great.

I'm trying to get it up and running and getting this error:

l addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://172.31.36.187:5000/ (Press CTRL+C to quit)
failed to send traces to Datadog Agent at http://localhost:8126
Traceback (most recent call last):
  File "/home/myusername/.local/lib/python3.9/site-packages/tenacity/__init__.py", line 407, in __call__
    result = fn(*args, **kwargs)
  File "/home/myusername/.local/lib/python3.9/site-packages/ddtrace/internal/writer.py", line 356, in _send_payload
    response = self._put(payload, headers)
  File "/home/myusername/.local/lib/python3.9/site-packages/ddtrace/internal/writer.py", line 332, in _put
    conn.request("PUT", self._endpoint, data, headers)
  File "/usr/lib/python3.9/http/client.py", line 1279, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1325, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1274, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1034, in _send_output
    self.send(msg)
  File "/usr/lib/python3.9/http/client.py", line 974, in send
    self.connect()
  File "/usr/lib/python3.9/http/client.py", line 945, in connect
    self.sock = self._create_connection(
  File "/usr/lib/python3.9/socket.py", line 844, in create_connection
    raise err
  File "/usr/lib/python3.9/socket.py", line 832, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/myusername/.local/lib/python3.9/site-packages/ddtrace/internal/writer.py", line 458, in flush_queue
    self._retry_upload(self._send_payload, encoded, n_traces)
  File "/home/myusername/.local/lib/python3.9/site-packages/tenacity/__init__.py", line 404, in __call__
    do = self.iter(retry_state=retry_state)
  File "/home/myusername/.local/lib/python3.9/site-packages/tenacity/__init__.py", line 361, in iter
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7f021177dbb0 state=finished raised ConnectionRefusedError>]

UPDATE: removed import ddtrace and patch_all() - now it is working :)

Packaging as standalone application (pyinstaller)

Thank you for a really awesome tutorial!

I'd like to package this as an application using pyinstaller. The straightforward approach doesn't seem to work (perhaps because of the directory structure), have you had any experience with this?

Explore Data Layover over Tables When Hovering

I've been trying to figure this out for a dash project I've been working on and came across your tutorial. I've been looking through the code to find how you did the layover when hovering over the tables, but can't find it. Any way you could point me to the place where the logic for this is at? Thanks.

How to change serve port from 5000?

Hi Todd,

Thank you for the amazing tutorial!!

Wanted to ask - how would it be possible to change the port being served from 5000? i.e. when deploying an app like this, so that user doesn't have to go to website.com:5000/dashapp/ but just serve it on one of the default ports?

Thank you!
Yaro

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

@login_required for /dashapp

First thanks for the tutorial.

I'm wondering if you could help me how to secure the /dashapp using @login_required decorator from flask-login.

Best Regards.
Kleyson Rios.

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.


  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.