# Python flask: Example with latest plotly

**URL:** <https://community.plotly.com/t/python-flask-example-with-latest-plotly/51706>\
**Category:** 📊 Plotly Python\
**Created:** [April 4, 2021, 2:07pm UTC](https://community.plotly.com/t/python-flask-example-with-latest-plotly/51706 "2021-04-04T14:07:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cplager](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@cplager](https://community.plotly.com/u/cplager)\
**Post date:** [April 4, 2021, 2:07pm UTC](https://community.plotly.com/t/python-flask-example-with-latest-plotly/51706/1 "2021-04-04T14:07:25Z")

</div>

There are several older examples of plotly and flask out there, but I have not found any that work with current versions of plotly; everything I see is now Dash.

I have a project that needs more stateful approach, so Dash is not working for me. Does somebody have an example of flask and current plotly?

Thanks!  
Charles

---

<div class="post-metadata">

**Author:** ![cplager](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@cplager](https://community.plotly.com/u/cplager)\
**Post date:** [April 4, 2021, 2:17pm UTC](https://community.plotly.com/t/python-flask-example-with-latest-plotly/51706/2 "2021-04-04T14:17:50Z")

</div>

I found that this example [plotly/plotlyjs-flask-example: A simple plotly.js example served with flask (github.com)](https://github.com/plotly/plotlyjs-flask-example) does work once you fix the issue of the template:  
[Does not display for me in Chrome and safari · Issue #2 · plotly/plotlyjs-flask-example (github.com)](https://github.com/plotly/plotlyjs-flask-example/issues/2)

```auto
Replace this line...
`<script src="https://d14fo0winaifog.cloudfront.net/plotly-basic.js"></script>`
...with this line...
`<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>`

```

It worked for me after that.

---

<div class="post-metadata">

**Author:** ![jcarson](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jcarson](https://community.plotly.com/u/jcarson)\
**Post date:** [April 5, 2021, 2:15am UTC](https://community.plotly.com/t/python-flask-example-with-latest-plotly/51706/3 "2021-04-05T02:15:57Z")

</div>

Glad you found an answer. I’m new to plotly and evaluating plotly/dash vs current work in bokeh/flask. I’d love to hear more about why you decided against dash and to just display your plots directly in flask templates instead.

I’ve been stashing state in dash’s Store object.

---

<div class="post-metadata">

**Author:** ![cplager](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@cplager](https://community.plotly.com/u/cplager)\
**Post date:** [April 5, 2021, 11:13am UTC](https://community.plotly.com/t/python-flask-example-with-latest-plotly/51706/4 "2021-04-05T11:13:49Z")

</div>

Hi @jcarson,

I’m new Dash as well. I’ve been playing with it, but am so far still more comfortable in Plotly/Flask. Not only the ease of state in Flask, but also I’m having an easier time having a function where I create not only the plots, but also dynamically control the layout. (It might very well be the case that this is just as easy in Dash and I just haven’t found the right example yet.)

Cheers,  
Charles

p.s. I was looking for how I could pass extra parameters into Dash, but I found the answer [in this question on the forum](https://community.plotly.com/t/python-dash-call-dash-app-with-get-parameters/51705/2).
