1

I am a reasonably experienced amateur python coder. With this site's help I have fought my way through, celery, channels, websockets, NGINX, docker etc etc to produce a website which controls my astronomy dome and some house automation.

Part of the astronomy setup is a 3rd party weather station which collects data (temperature, wind speed, humidity, brightness, rain etc) and distributes a json file every 15 secs. I have successfully coded pyhton / Django / Plotly to collect the data and produce one graph (temperature). I have successful embedded this graph in a webpage.

The next step is to add a drop down box as a choice mechanism for what data (e.g. temperature or bightness) to show in the graph.

I think I can do this with websocket calls.

Should I use Dash instead ? I have found plotly relatively easy to use and I am attracted to the idea of using the bootstrap plugin to manage bootstrap in python code as opposed to in an html page.

but

Problem: installing Django-Plotly-Dash v2.0 downgrades django (v4.0.5 to 3.2.13), daphne (v3.0.2 to 2.5.0) and channels (v3.0.4 to 2.4.0). I'm not sure if that is going to 'break' anything but since everything is 'dockerised' troubleshooting broken code is not something I want to do, if I can avoid it.

Problem: I would need to 'move' bootstrap code from html to python...... shouldn't be an issue ? Just time consuming ?

Opinions from anyone with experience of using Django with Plotly and Dash would be most welcome. Thank you

SgtBilko
  • 55
  • 2
  • 9

2 Answers2

1

Well, here you have multiple options on how to properly handle your needs.

As for django_plotly_dash, you may check their setup.py file. Note that they expect you to have Django>=2.2,<4.0.0. So it's understandable that installation automatically downgrades your Django version.

So here are the options you may consider:

  • Preferable if you really need django_plotly_dash lib: downgrade your Django version;
  • If you have some alternative solutions: look for another solution (get rid of django_plotly_dash);
  • If you feel like you could handle possible issues: fork django_plotly_dash, then update setup.py Django requirement to Django>=2.2, then install the lib from your personal repo. Again, that may cause you a lot of issues, so you'll need to test everything properly.

As a bonus to the last option, if you'll make a successful upgrade, you may make a PR to an original repo and thus contribute to an open-source project.

Lich
  • 482
  • 2
  • 10
  • Thank you for your comments. I love the idea of contributing to an open-source project; some sort of payback for all the hours other coders have saved me, but I wouldn't know how to and what the etiquette is. As a rank amateur I would be nervous of treading on the toes of experts. – SgtBilko Jun 30 '22 at 15:21
0

Downgrading and upgrading versions can definitely break your project. Especially when you are downgrading major versions.

For your next project you should use the LTS version, not the latest. Especially if you intend to use that code in a production environment. Tools' developers will consider supporting LTS versions and not the latest versions. The current LTS version for Django is 3.2. According to the roadmap the next LTS version will be 4.2 in 2023.

I'd consider just using plotly or another library because you have to downgrade many packages to support Dash. Unless you decide to downgrade to use the LTS version.

Cholax
  • 48
  • 1
  • 6