pyctuator icon indicating copy to clipboard operation
pyctuator copied to clipboard

Django usage

Open susuusus opened this issue 4 years ago • 5 comments

Hi, any example to implement this in django. Thanks

susuusus avatar Oct 06 '21 04:10 susuusus

Hi @susuusus , we've been wanting to add Django support for a while now, but none of us is familiar with it enough to do that.

If you're up for the challenge, we're open for contributions and would definitely help with the implementation if you can contribute an initial PR for Django support. Pyctuator's API is rather simple, so adding support for a new framework is relatively straightforward, assuming you're familiar with the framework.

MatanRubin avatar Oct 06 '21 06:10 MatanRubin

Hi Team, Any update on this, I suppose it is a very useful feature. Thanks

jijunnniu avatar Oct 12 '22 03:10 jijunnniu

Hi @jijunnniu , the previous comment still applies. If you are up to the task, I can point you to where you should start.

michaelyaakoby avatar Oct 12 '22 07:10 michaelyaakoby

I can look into this if someone else isn't and someone can point me.

mittal-umang avatar Feb 27 '23 19:02 mittal-umang

Thanks @mittal-umang, this will be great.

To get started, clone the project and follow the instructions in https://github.com/SolarEdgeTech/pyctuator#contributing.

Next, in order to add support for django (or any other web-framework) you'll need to:

  1. Add django dependencies as optional (for the sake of non django users)
  2. Implement PyctuatorRouter in a new file pyctuator/impl/django_pyctuator.py (see any of the other implementation)
  3. Create optional "web framework integration" in pyctuator/pyctuator.py (see framework_integrations, the key should be the name of the django package, guess its django)
  4. Create a "django test server" in a new file tests/django_test_server.py which will be used by the end-to-end test
  5. Register the "django test server" in @pytest.fixture in the test/test_pyctuator_e2e.py test
  6. Document the integration of pyctuator in the readme file
  7. Add an example in the examples folder

It'll indeed be great of you can do this. Thanks!

michaelyaakoby avatar Mar 04 '23 21:03 michaelyaakoby