11 ms·
Ask HN: Why aren't Django Admin style dashboards popular in other frameworks?
We're a Django shop and we get tremendous value out of Django Admin. Most python-heads I know suggest Django Admin as a major reason to go with Django over flask or FastAPI. Beyond that, I don't think there's a clear equivalent in another language either. My question is this:
Why has Django Admin proliferated so strongly in the Django ecosystem while being unreplicated elsewhere?
- itsthecourier 3y agoActiveAdmin in rails
- tarellel 3y agoMy team has gotten bitten by ActiveAdmin a few times in the past. We've switched to Avo and it's been an absolute wonder.
- withinboredom 3y agoMostly because it is dangerous (or was). For example, an integer that can only be 1, 2, or 3. In the admin (way back in the day, at least), someone could go into the admin and set it to 4. Which would then break everything in subtle ways. Also, most applications have constraints like "X can only be 2 if and only if Y is equal to Z" ... there was no way to specify that constraint to the admin interface, so someone could set X to be 2, and it would break programmer assumptions who wrote code expecting Y to be equal to Z.
- rburhum 3y agoif your model is a choicefield, then it only shows you those values and you can’t do what you are describing. Additionally, you have validation that can happen at the class level, group of fields, or field.
- petepete 3y agoI don't know Django but doesn't model validation apply to the admin screens?
- loloquwowndueo 3y agoIt does but in general there’s less insistence (as compared to Rails, for example) to have “smart models, dumb controllers” - therefore in Django a lot of business logic can end up in the controller and thus doesn’t apply in the admin. This is a convention though - one could just as easily do it the other way and embed all the business rules in the models.
- withinboredom 3y agoIt used to not be IIRC. This was over a decade ago, so my information is likely outdated, but it might explain why other languages chose not to implement it. Further, a model may be valid, but make no sense to an application. For example, a car may have 6 wheels and still be a car ... but might be out-of-bounds for a simulation expecting 4 wheels.
- evantbyrne 3y agoMust have been well over a decade because Django models have had deep integration with the form validation API since I started my career.
- stuartjohnson12 3y agoI can confirm you can do this validation now, but it's not super-super easy.
- rburhum 3y agoyes it does if implemented correctly with that intention in mind
- timetraveller26 3y agoI think you can can still have those checks as pre_saves in your models
- simonw 3y agoThis is very out-of-date. Easily adding validation has been a key benefit of the Django admin for more than a decade at this point. (You still have to do the work, but if people are breaking things through the admin that's your fault.)
- random_kris 3y agohttps://payloadcms.com/ https://payloadcms.com/ For js/node
- AaronNewcomer 3y agoNova in Laravel. https://nova.laravel.com https://nova.laravel.com
- mgkimsal 3y agoNot free or baked in. It's decent overall, but I think filament and orchid are overall a better value. Both because they're free but feel a bit easier to work with, and seem to have faster-growing ecosystems.
- mdisc 3y agoI think it has to do with the times. Because sl admin came up in a pre DRF time when people use Django to serve templates, the work to build it into the framework came more naturally. With lots of more modern web app frameworks mainly focusing on just being APIs for single page applications, having html templates and stuff in the core project and having contributors build this stuff in doesn’t happen as naturally. I totally agree though- huge selling point of Django!
- oooyay 3y agoCounter point: I actually use DRF and the Django Admin. They're not really at competition with each other.
- deleted 3y ago[deleted]
- compumike 3y agoCan you clarify what's the "tremendous value" you're getting out of the Django admin? At Heii On-Call https://heiioncall.com/ https://heiioncall.com/ we are using Active Admin https://activeadmin.info/ https://activeadmin.info/ for Ruby on Rails, which seems quite similar to the Django admin. In my experience, it's mostly useful as a fairly basic read-only view of what's in the database. In Rails, it's so easy to whip together a custom view that we tend to do that, and the Active Admin is nice to have but I wouldn't say "tremendous value".
- simonw 3y agoThe value in the Django admin is much more about data entry than purely read-only data access.
- hnfong 3y agoTotally agree. I recently dabbled a bit in stock picking, and built a system to record my commentaries on stocks and my subjective valuation, so that I can refer to them later (so that I have something to base my trades on other than pure emotion). I just defined the models and used the admin interface for all the editing. I mean, in theory it's not much different from using an excel spreadsheet to keep my records, but I get a full SQL database and a customizable webUI for free after I defined my models. And if I need anything fancy I have a fully programmable system that I can extend arbitrarily. In django, as long as the functionality is only exposed to trusted users (hence it's called "admin"), there's very little reason to write any "views" logic after you defined the model and basic controller logic. It's basically the generic CRUD app that you don't have to write.
- siva7 3y agoAs soon as you need frontend auth you'll regret going with flask or fastapi. There is no equivalent in the python world for django admin
- saasjosh 3y agoWhat do you mean?
- hdjjhhvvhga 3y agoCan you elaborate? Both Flask and FastAPI support various authentication methods.
- siva7 3y agoNone of them matches the out-of-the-box functionality of django for a classic saas app. You're constantly reinventing the wheel to get a production-ready user & auth workflow.
- postpawl 3y agoFlask has flask-admin: https://github.com/flask-admin/flask-admin https://github.com/flask-admin/flask-admin
- michaelteter 3y agoIt’s mostly just a UI for CRUD. And most systems are more complex, requiring UIs that operate on business logic. Rails and Phoenix also offer similar features (called scaffolds), but they are optional. I’m sure other frameworks have similar options. Meanwhile, Django (like Python) sometimes has unconventional names and approaches to doing common things, so that makes the pair unpleasant and awkward for those of us with experience with several other tools and frameworks.
- Scarblac 3y ago> most systems are more complex Citation needed. We also have got a _lot_ of mileage out of it over the years.
- sojournerc 3y agoOk, how complex are _your_ systems? Simple table views are available through a number of database management software (dbeaver). What does django provide beyond that?
- acdha 3y agoWhat do you think is missing – your broad claim was made authoritatively enough that I’m assuming you had bad experiences somewhere?
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- Scarblac 3y agoYou can customize the admin so it only shows some tables, you can add actions that run things in the backend, the changes go through your Django models so they run validation etc. In short you really can give it to knowledgeable admins at customers to configure and admin applications with, in a way that you can't just let them edit database tables.
- reyostallenberg 3y agoAdmin for Symfony Framework ( PHP ) https://symfony.com/bundles/EasyAdminBundle/current/index.html https://symfony.com/bundles/EasyAdminBundle/current/index.ht... Admin for Laravel (PHP) https://nova.laravel.com/ https://nova.laravel.com/ Java Spring Boot https://docs.spring-boot-admin.com/current/getting-started.html https://docs.spring-boot-admin.com/current/getting-started.h... I think many other Frameworks have this, did you search for it?
- somehnguy 3y agoThe Spring one linked above is not really comparable to Django admin in my opinion. In particular it doesn’t integrate with your data model at all - it essentially just shows actuator endpoints.
- simonw 3y agoRight, it describes itself as "Spring Boot Admin is a monitoring tool".
- arrowsmith 3y agoPhoenix has Kaffy: https://github.com/aesmail/kaffy https://github.com/aesmail/kaffy Super-simple to set up and it's been perfectly adequate for my app's needs so far. To answer OP's original question: Django Admin isn't a killer feature because the same kind of thing is available for most other Django-like frameworks, with the only difference being that it's usually a third party library rather than something built into the framework itself.
- simonw 3y agoBeing built into the framework is a big deal, though. The problem with third-party libraries for this kind of thing is that there's no guarantee that they will be maintained in lockstep with the underlying framework. What if they get abandoned? Or a new version of the framework comes out with new features but the third-party library takes months to add support for them? I think this may be an aspect of Django that isn't appreciated nearly as much as it should be: batteries included means that the feature you depend on are guaranteed to be maintained and documented at the same pace as the rest of the framework.
- evantbyrne 3y agoIt's hard to do well, especially if the framework isn't built from the ground-up to meaningfully model database schemas. It basically involves creating a CMS which is a project in of itself. Do you stop at building Django or do you keep going until you have created Wagtail? There's a ton of value in it, but it's tough.
- resoluteteeth 3y agoIt's hard to automatically generate a useful admin dashboard like this in a framework that's not oriented around crud apps with certain assumptions baked in. Most frameworks/platforms that are oriented around crud apps, where the framework itself does have a concept of models, do have some sort of admin dashboard feature. Flask is a microframework that doesn't make assumptions about any database/models, so it's impossible for it to do something like this. However, there is arguably a limited range of apps where an automatically generated admin dashboard is going to be useful anyway.
- oooyay 3y ago> Why has Django Admin proliferated so strongly in the Django ecosystem while being unreplicated elsewhere? It's useful when I start a project, but if that project matures I generally replace it with something tailor made to the application. In other languages and framework I end up building an admin panel too, just in Django I end up doing that later in the process. Replicating the Django admin is tough too. It's made to be highly generic and it remains stable release to release. Any project seeking to replicate that would need to replicate Djangos abstraction model in order to achieve any kind of stability like the Admin view has.
- the__alchemist 3y agoI love the Rust language and tooling, but don't use it for web dev because it lacks something like Django. I build web backends in Python because of Django. Not exclusively because of admin, but that's part of it. (Other parts include built in DB auto migrations, auth, email, templates, [de]serialization, tightly-integrated ORM etc) I can't figure out the intended workflow for using the Rust frameworks. When I ask (eg rust webdev communities) how to build a website using them, I get no responses, or comments about how Diesel is better than Django's ORM. It seems more doable with Flask etc in Python because of the robust ecosystem of third-party addons, but it still seems like a complexity trap due to potential mutual incompatibilities between them. The admin page in particular is excellent for debugging, changing config, quick queries etc.
- karaterobot 3y agoI've been out of web development for about four years now, but I think Django is unusual in providing the admin dashboard for free. Most frameworks don't want to devote the resources to that when there are third-party options you can fairly easily (ha ha) bolt on to your project. Speculatively, it may be that Django comes from a time before such a wide variety of self-service solutions existed, and based on the newspaper use case they built the framework to support, they felt like it was worth the time to do it.
- simonw 3y agoWe originally created Django as a CMS for some newspaper websites. We didn't even think of it as a framework - we called it "the CMS" for the first ~10 months that we were working on it. https://simonwillison.net/2010/Aug/24/what-is-the-history/ https://simonwillison.net/2010/Aug/24/what-is-the-history/
- stuartjohnson12 3y agoI'm curious how you think about Django's CMS capabilities compared to less opinionated languages and frameworks. Do you think the fact that Django is so opinionated is necessary for Django to be as good as it is? If Django was built more like FastAPI could something like Django Admin still work? Is Django Admin special because of the execution, or because of the capabilities that the design of Django enables it to have?
- simonw 3y agoPersonally I think it's mainly down to the fact that the ORM and admin were designed together, with the intention of supporting the subset of operations needed to build a CMS. That's one of the reasons it doesn't support things like compound primary keys very well - it turns out you don't really need those for the common CMS subset of functionality.
- stuartjohnson12 3y agoWhat third party options would you recommend? I'm aware of ReTool and Airplane.dev, but both of them feel like I'm a technician fighting an interface and not a software engineer writing functionality.
- zzzeek 3y agoKeeping in mind I'm referring to Django years ago, as I dont know how many of these limitations have since been lifted, the Django admin was able to be successful because Django itself only allowed a narrow subset of database constructs to be modeled in the first place. You had tables with single-column primary keys only, and then you had simple one to many, many to one, many-to-many, and their "generic foreign key" thing, and IIUC that was it. This narrow band of possible database configurations made it easier to put an admin on top of (and also to generalize into DB migrations). There are "django-admin" style tools for SQLAlchemy (or at least there were, back when people had the notion that "the Django admin" was why Django was successful), but they have a hard time being able to generalize to SQLAlchemy's capabilities for things like table inheritance, custom join conditions, composite keys, etc. Our users, when they build out their database schemas, are throwing the whole kitchen sink in there and producing a much more personalized kind of product that does not lend itself as well to a generic CRUD gui. Nor do a lot of SQLAlchemy users really want such a thing, since they will have these very particular types of models with lots of nooks and crannies that they'd prefer to code up themselves. The SQLAlchemy approach is a lot more schema oriented whereas the Django one strikes me as intentionally narrowed for simplicity.
- dsissitka 3y ago> Beyond that, I don't think there's a clear equivalent in another language either. Filament seems promising for folks working with Laravel: https://demo.filamentphp.com/ https://demo.filamentphp.com/ I don't think it's quite there yet though. It's pretty slow.
- gjsman-1000 3y agoI recently built a Filament application and have a few thoughts. 1. The docs for going from v2 to v3 were woefully incomplete unless you were using only basic v2 features. Unnecessarily painful. 2. Speed is relative. For people coming from WordPress or other systems, it’s just fine if you do some basic optimization. 3. If you’re going to use it outside of the Admin Panels in the rest of your app… structure appropriately. It’s not a skill taught in the documentation but is vital. It’s easy to make a mess.
- ajmurmann 3y agoRails also has rails_admin and some others I forget.
- BiteCode_dev 3y agoA core developer of Django, I think Carlton Gibson but can't find it, mentioned in a podcast that if one were to commission the development of Django's admin interface from scratch today, it could cost around $1 million USD.
- tjrgergw 3y agoHmm. I know Django admin is one of the best things about Django... but why $1m? If each developer gets paid $200k/yr, that's 5 developers for 1 year? Sounds crazy to me.
- samtho 3y agoAlso a project manager, and one of those is a lead developer/architect. One year is not a lot of time, either.
- simonw 3y agoYeah, that sounds about right to me. The admin has a a LOT of features. More importantly, it's been continuously evolving for nearly 20 years at this point. Anyone who's actually tried to do a from-scratch rewrite of a system that has 20 years of development behind it will know that 5 engineers for a year is probably optimistic!
- hnfong 3y agoGiven the flexibility and depth of the django admin, 5 good developers working on it for 1 year sounds about right. 200k/year might sound like a lot but then in a real business there are various overhead costs as well. I'd say $1m is probably on the lower side of the estimate. Factoring in project delays and misc Murphy law things, wouldn't be surprised if a mediocre team underdelivers with a crappy immitation of the django admin interface after blowing through a couple mil.
- BiteCode_dev 3y agoThere is the frontend and the backend, the whole introspection stack, the admin customization layer, and the integration with permission, filtering, caching, etc. Add on top of that documentation, testing, and making the whole thing completely independent and pluggable (as django must work without it) but perfectly integrated with it (settings, forms, template overrides, etc). That's a lot. You might get feature parity with less, but not with the same guarantees of stability and maturity.
- boopmaster 3y agoThe one data point I can offer is that beat scheduler is a must have for our tiny moonlighting-as-devops squad, and that integrates perfectly with the admin panel. So, in a word: Celery. This also allows django tasks to be fired from other clients (other than a direct web site visit), which permits us to author tasks that can be leveraged from other containers/app instances. Almost all CRUD ops are handled purely in the backend as like "not really django-like" implementations, which suits us perfectly - in case we want to pack up our things and move to a new framework.
- rburhum 3y agoThe cool thing about django admin is how easy it is to customize within the bounds that it was designed for. You have one liners to add calculated values, complex filters, inline records from related tables, a permission model to limit operations and/or access to certain objects (or records), custom actions on a set or subset of items, import/export, etc etc. 99% of it without touching HTML or CSS. If you need something more complex, you just build it, but right out of the box it provides a lot of options for the content managers. If you stay within the bounds of how it was designed, the extensibility model is solid.
- mdasen 3y agoIt's probably a combination of things. The Django Admin existed before Django publicly existed. That meant that once anyone started using Django they knew that they should constrain their use of Django in certain ways so that the Django Admin would work with their usage. Features that would be added to Django would be built with the Django Admin in mind. Many tools like Flask or FastAPI don't have an opinionated model layer like Django. Without that, you can't really create an admin interface programatically. People could be storing their data in any sort of fashion anywhere. How would one build an admin system for something like Flask or FastAPI where there's no convention around how people set up data access? A lot of frameworks out there don't tell you "access your data in this way" or "this is how users will be authenticated." Without those two things, it's hard to really create an admin system. There are similar systems available for some frameworks, but since they aren't part of the core framework, they don't get the same attention. Someone creates it, but it doesn't have the kind of community buy-in that sustains it. One of the odd things about Django is that the admin system is under `django.contrib` which indicated that they didn't intend for it to be in the core of Django forever, but that's not really how `django.contrib` ended up. It continued to be a core part of Django maintained as part of the framework. Like I said, there are admin dashboards available in other frameworks like RailsAdmin (https://github.com/railsadminteam/rails_admin https://github.com/railsadminteam/rails_admin) or Core Admin for .NET (https://github.com/edandersen/core-admin https://github.com/edandersen/core-admin) and I'm sure there's more. However, both Rails and .NET provide most of what Django provides (and a lot more than most frameworks). Rails and .NET both have a default data access ORM that a majority of people using those frameworks tend to use. .NET has built-in authentication/authorization so the admin can work off that. Rails doesn't have auth, but RailsAdmin uses some plugins. There's even Flask-Admin: https://flask-admin.readthedocs.io/en/latest/ https://flask-admin.readthedocs.io/en/latest/. However, if you start reading through the docs you start seeing that you have to solve more than just dropping it in. How do you do auth and permissions? Have you used SQLAlchemy, MongoEngine, PeeWee, or PyMango to access your data? No? Well, you might need to write a way for it to actually figure out your data. Because Flask apps aren't generally written with Flask-Admin in mind and because Flask doesn't offer a default path for things like models and auth, it becomes a harder and more varied task to create a generic admin system.
- 3y ago
- eureka-belief 3y agoMaybe the batteries included approach allows the ORM to synergies with the admin in a way that would be harder in other frameworks where the tooling is more ad hoc?
- Fire-Dragon-DoL 3y agoActiveadmin in rails. The reason I believe you need an extremely widespread framework that standardized everything, like rails or django. Kinda funny how I really disliked activeadmin 10 years ago, now I have an app that's been running for like 12 years using it and it's been doing great. Also, activeadmin improved drastically, kudos to the community
- deleted 3y ago[deleted]
- daft_pink 3y agoI think flask and fastapi are just intended to be very basic easy and quick and that's why they don't include this type of thing.
- Chiron1991 3y agoThe core reason is (imo) that it's simply not possible to provide a Django admin equivalent in other frameworks because they lack the functionality to do so. The basic dependencies for the Django admin are: - authentication - user permissions - forms - the ORM, to generate forms from model definitions and forward the admin's CRUD operations to the database No other framework comes with all of these dependencies builtin. Yes, there are individual plugins to retrofit them, but then you would start building your extremely complex admin plugin on top of a lot of unaligned dependencies. Just one of them needs to go into a direction that doesn't align with your needs and your project is done. That's not a good base to start from. Django doesn't have this problem because the entire framework is built under one roof.
- skydhash 3y agoLaravel has the foundation for these baked in. And they provided a paid admin packages if you don’t want to implement the rest. My opinion is that once you add a dependency to your project, you own it just like your own code. This means understanding it enough to know how it’s built, but for the time being, someone else is maintaining it. And that a donation every once in a while should be made if it’s a core part of your product.