Advice on writing a package for Django integration


#1

Hello.

I’ve got two apistar projects in production at the moment. Unfortunately, they’ve both had to stay at <0.4.0 because of the removal of the ORM components.

I’m interested in upgrading and am therefore interested in writing a package to re-introduce Django support. The problem lies in the fact that I’m not sure where to start. The SQLAlchemy integrations seem fairly straight-forward, but I fear a similar Django integration would be more complicated.

If anyone has done this integration already, or knows a good place to start it would be much appreciated.

Thank you


#2

Hi,

I would start placing everything in the old Django ORM integration similar to the the new 0.5.x SQLAlchemy integration.

  • The configure() and setup() goes into Component.__init__().
  • Session can go into Component.resolve().
  • get_session() goes into hooks like the SQLAlchemy integration.
  • commands probably you can place where you want and just main.add_command(your_func) like in main.py.

Good component!