Member-only story

How to Setup a Django Admin Page For MongoDB

Adam Berg
5 min readApr 26, 2021

--

The year is 2013 and you’re looking to start a new SaaS application. You’ve been following the latest trends and decide to go with The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js. It won’t be until a few years later that you regret most of these decisions, before finally settling into the acceptance phase. Jokes aside, MongoDB has carved itself a spot as one of the top NoSQL databases and will be around for the forseeable future.

If you are using MongoDB, you are likely also using Robo 3T or MongoDB Compass to manage your data. This post describes how to quickly setup an admin page using the Django framework and djongo connector that makes it a breeze to view and modify data in your database.

What is Django?

From Django’s homepage: “Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design”. Better yet, run through their 7 part tutorial to see what it does and how it works (This is the best web framework tutorial I have been through).

While Django is primarily intended to be used as the framework for your entire backend, that doesn’t mean that’s how you must use it. In my case, I yearned for the admin site functionality that is built in to Django, but didn’t want to run the rest of my app there.

What’s so Great About the Django Admin Page?

From Django’s second tutorial:

Generating admin sites for your staff or clients to add, change, and delete content is tedious work that doesn’t require much creativity. For that reason, Django entirely automates creation of admin interfaces for models.

Django was written in a newsroom environment, with a very clear separation between “content publishers” and the “public” site. Site managers use the system to add news stories, events, sports scores, etc., and that content is displayed on the public site. Django solves the problem of creating a unified interface for site administrators to edit content.

The admin isn’t intended to be used by site visitors. It’s for site managers.

Django Admin List Users Page

The Django admin site allows you to view and modify existing data without having to connect directly to your…

--

--

Adam Berg
Adam Berg

Written by Adam Berg

Building https://kaizen.place. writing about C, C++, rust, game development, web development, engineering management. https://devtails.xyz/

No responses yet

Write a response