Tuesday, November 11, 2008

Integrating Django and ASP.NET

Using NWSGI to run Django on IronPython opens up some interesting possibilities, such as using ASP.NET's caching, session, or authentication systems for Django. I imagine any ASP.NET shop spent time configuring their ASP.NET providers for those systems, and I thought it would be interesting to see if that effort could be used for Django apps as well, and it certainly looks like they can.

A demo version of django-aspnet is now available. I'll expand on the details later, but for now: set the *_BACKEND variables in settings.py to point to these modules (they must be on the Python path). All other configuration settings for the Django apps are ignored; you must use Web.config to configure them, like any ASP.NET app.

Some parts are still missing, but the basic functionality seems to work.

4 comments:

  1. That's awesome!
    I'm looking forward to trying it out.

    ReplyDelete
  2. I was able to successfully create an application with IronPython with quick start instructions:

    mk django_projects [Folder]

    In the folder type ipy c:\Program Files (x86)\IronPython 2.0\django-admin.py startproject project1

    cd project1

    edit settings.py and configure database connections (using MySQL).

    test: ipy manage.py startapp app1

    All the above steps work awesome.

    Then I want to publish this to IIS7 with the NWSGI 0.7 handler installed but I am missing some of the other configurations. The hello world example works but I am a n00b with Django and Python

    ReplyDelete
  3. Might want to wait until they fix the issue with f_frame. I had some trouble running ipy manage.py syncdb

    http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15399

    ReplyDelete
  4. This rather good phrase is necessary just by the way

    ReplyDelete