SolarEdgeTech/pyctuator

Django usage

susuusus opened this issue · 5 comments

Hi, any example to implement this in django. Thanks

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.

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

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

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

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!