One thing I end up doing quite a bit of at work is developing custom web applications that sit on the company intranet. These aren’t your basic timecard application or company web portal. Instead, these customized applications do everything from reports and dashboards from our bug tracking software to providing a web service API to our test case management solution. This post is about chronicling some of our forays into intranet apps.
Every intranet app needs authentication
If your company is anything like mine, you have a huge Active Directory system and your webservers are protected by single-sign-on (SSO). Django plugs into that nicely with the RemoteUserMiddleware so that users don’t have to remember Yet Another Password for your app. My password to our off the shelf commercial bug tracking software is still “welcome” and my password to our “Agile” project and task tracker is “test”. I’m already on the corporate intranet. Why should I have to authenticate twice? With Django and RemoteUserMiddleware, your users are automatically logged in if they’re authenticated. It seems relatively trivial, but it greatly enhances the user experience to not have to remember the password to the /admin site.
Who needs /admin
It seems that virtually every application has some sort of need for admin functionality. We used to deploy phpMyAdmin on most of our web hosts to administer our content. It was dove hunting with a bazooka. There was little fine grained control and we ran into the same issue of re-authenticating to access the admin site. Now an admin site is not unique to Django and it exists in virtually every major web framework in every major language. This point can be taken as an overwhelming endorsement of using some framework over using no framework at all. However, Django’s admin site is easy and very customizable in case you need to pretty up your admin site because it will be accessed by a wider audience.
Intranet apps have a way of becoming internet apps
You never know management decides some piece of software that was never intended to be used externally suddenly is a must have for some outside group and it needs to be internationalized (into Japanese?!). Suddenly, all the code has to go through open source compliance, export compliance, code scans, and due to licensing restrictions management doesn’t want to ship with MySQL. Unfortunately, that software was written in Java and PHP with no framework and quite a few open source libraries that we couldn’t ship. The transition was much more painful than if we would have just used Django from the start.
Merging and splitting apps
I’ve released and deployed a number of web applications, but the real nightmare comes when apps are merged together or one app is broken apart. This is where Python’s packaging and the Django concept of splitting your project into multiple individual apps really shines. I’ve run into this from a couple of different sides. I’ve had to take multiple PHP applications and merge them together into a single deployment. There was a huge mess with including common code and the solutions aren’t great. You’re either messing with include_dir in php.ini — a huge nightmare when managing multiple deployments with different includes, or you’re stuck modifying every include statement to pickup libraries from a common location. Splitting apps up runs into similar issues. Packaging separable components into different apps used by your project really is the way to go and Django works with this very well.
I’ve developed web apps in Java, Perl and PHP and by far I’ve been happiest with Python and Django. There are other great frameworks out there for these languages and using them could definitely help alleviate some of these issues, but the Django solution fits together better than anything I’ve seen from Struts, CodeIgniter or one of the dozens of other frameworks out there. For me, there has to be a pretty compelling argument not to do new apps with Django.
4 thoughts on “Using Django for Intranet Applications”
Interesting post. Sorry I’m a bit late in responding but I’ve just recently started looking at django as an alternative for some intranet-type applications. Part of my requirements include: paid time off tracking, micro-blogging, policy and memo delivery, organization news, inventory management, bug tracking/feature request software.
I initially looked at Rails for this but I find Ruby very obtuse and Rails to be very confusing (for me). Do you feel that Django can handle “enterprisey” applications. Most of everything youbsee out there is a news site or social networking site. You don’t see a lot of django apps that do a lot of processing and what not.
About what functionality are you concerned? At work, we use Django for moderate traffic (~500 total intranet users), somewhat intensive applications without many problems. In general, I choose Django for nearly every web based project where that decision is left up to me. The applications you described seem pretty straight forward and Django should be able to handle them unless you are doing something crazy.
However, there are cases where Python may not be the best language choice to get the job done or Django may not be the best fit and in those cases you have to consider other options. We have an upcoming code analysis project that will rely heavily on MSSql Server (and other databases) and I have some reservations. Although pyodbc is pretty solid for database access from Linux to MSSql, django-pyodbc has raised some concerns due to lack of support. We are considering using Python with SQLAlchemy/Elixir (with and without Django) as well as Java. This application will have a database with billions of records and will do code analysis on tens of millions of files. However, my concerns aren’t with Django’s ability to handle that data but rather with support for the database packages we’ll be using.
Thank you for this helpful post,
As a freelancer Codeigniter framework (PHP) is what i
m currently using on daily tasks but i decided to change due to the fact that you still have to write a lot of code to accomplish a task.
i have an intranet application at hand now, the application will manage church and support church branches and managers for each branch, support complex search etc, also automatic sending of newsletter, sms, produce report on pdf, and excel format.
Should i use django admin? im wondering how we can customize the django admin to fit our design.
Thank you for your support
I have only one short experience with CodeIgniter so I don’t feel qualified to properly compare the two. Django will not completely prevent you from writing code. However, it does make things fairly easy. Given what you described, I definitely think Django could handle it. The Django admin is highly customizeable and I’ve seen a couple commercial products that leverage it heavily.
At the same time, there will be some ramp-up time for you and your team on Django and on at least your first project I’d expect that you could get things done more quickly with CodeIgniter for the simple fact that you know it better.
Comments are closed.