Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    Interview

    10 Sorting Algorithms Interview Questions: Theory and Practice for 2019

    AWS

    Building a serverless web application with Python and AWS Lambda

    Programming

    17. Уроки Node.js. Таймеры, Отличия от Браузера, ref и unref

    Important Pages:
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Today's Picks:
    • Scaling Success: Monitoring Indexation of Programmatic SEO Content
    • Leveraging Influencers: Key Drivers in New Product Launches
    • How Privacy-First Marketing Will Transform the Industry Landscape
    • The Impact of Social Proof on Thought Leadership Marketing
    • Balancing Value-Driven Content and Promotional Messaging Strategies
    • Top Influencer Marketing Platforms to Explore in 2025
    • Emerging Trends in Marketing Automation and AI Tools for 2023
    • Strategies to Mitigate Duplicate Content in Programmatic SEO
    Tuesday, September 9
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Soshace Digital Blog
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Services
    • SaaS & Tech

      Maximizing Efficiency: How SaaS Lowers IT Infrastructure Costs

      August 27, 2025

      Navigating Tomorrow: Innovations Shaping the Future of SaaS

      August 27, 2025

      Maximizing Impact: Strategies for SaaS & Technology Marketing

      August 27, 2025
    • AI & Automation

      Enhancing Customer Feedback Analysis Through AI Innovations

      August 27, 2025

      Navigating the Impact of AI on SEO and Search Rankings

      August 27, 2025

      5 Automation Hacks Every Home Service Business Needs to Know

      May 3, 2025
    • Finance & Fintech

      Critical Missteps in Finance Marketing: What to Avoid

      August 27, 2025

      Analyzing Future Fintech Marketing Trends: Insights Ahead

      August 27, 2025

      Navigating the Complex Landscape of Finance and Fintech Marketing

      August 27, 2025
    • Legal & Compliance

      Exploring Thought Leadership’s Impact on Legal Marketing

      August 27, 2025

      Maximizing LinkedIn: Strategies for Legal and Compliance Marketing

      August 27, 2025

      Why Transparency Matters in Legal Advertising Practices

      August 27, 2025
    • Medical Marketing

      Enhancing Online Reputation Management in Hospitals: A Guide

      August 27, 2025

      Analyzing Emerging Trends in Health and Medical Marketing

      August 27, 2025

      Exploring Innovative Content Ideas for Wellness Blogs and Clinics

      August 27, 2025
    • E-commerce & Retail

      Strategic Seasonal Campaign Concepts for Online and Retail Markets

      August 27, 2025

      Emerging Trends in E-commerce and Retail Marketing Strategies

      August 27, 2025

      Maximizing Revenue: The Advantages of Affiliate Marketing for E-Commerce

      August 27, 2025
    • Influencer & Community

      Leveraging Influencers: Key Drivers in New Product Launches

      August 27, 2025

      Top Influencer Marketing Platforms to Explore in 2025

      August 27, 2025

      Key Strategies for Successful Influencer Partnership Negotiations

      August 27, 2025
    • Content & Leadership

      The Impact of Social Proof on Thought Leadership Marketing

      August 27, 2025

      Balancing Value-Driven Content and Promotional Messaging Strategies

      August 27, 2025

      Analyzing Storytelling’s Impact on Content Marketing Effectiveness

      August 27, 2025
    • SEO & Analytics

      Scaling Success: Monitoring Indexation of Programmatic SEO Content

      August 27, 2025

      Strategies to Mitigate Duplicate Content in Programmatic SEO

      August 27, 2025

      Effective Data Visualization Techniques for SEO Reporting

      August 27, 2025
    • Marketing Trends

      How Privacy-First Marketing Will Transform the Industry Landscape

      August 27, 2025

      Emerging Trends in Marketing Automation and AI Tools for 2023

      August 27, 2025

      Maximizing ROI: Key Trends in Paid Social Advertising

      August 27, 2025
    Soshace Digital Blog
    Blog / Beginners / How I Built an Admin Dashboard with Python Flask
    Beginners

    How I Built an Admin Dashboard with Python Flask

    BukunmiBy BukunmiAugust 2, 2020Updated:May 26, 2024No Comments8 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    How I Built an Admin Dashboard with Python Flask
    How I Built an Admin Dashboard with Python Flask
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link
    How I Built an Admin Dashboard with Python Flask
    How I Built an Admin Dashboard with Python Flask

    Before I jump into the the full details and guidelines of how I built this Admin Dashboard, let’s know what Python Flask is and why I decided to build this Admin Dashboard with Flask.

    Flask
    Flask

    Flask is a lightweight Python web framework that allows users to build web application faster and easier and also give its users as much flexibility as possible in building and scaling their web applications.

    Flask is a micro-framework, hence, it allows its users to use their preferred extensions and packages in building their web applications. Unlike other frameworks, Flask doesn’t force its user to follow a particular layout hence its flexibility.

    It’s also important to note that Flask has a large community that provide answers to different questions and issues you might face as a Flask developer, they also build and provide so many open source packages for smooth sailing while building a flask web application. Flask has an in-built web server that allows the Python application to process and also makes the Python application accessible to the public.

    Now that we have a clear overview of what Flask is, I’ll talk about MongoDB, the database used in storing the user data gotten on registration on this Admin Dashboard.

    MongoDb
    MongoDb

    MongoDB is an open source document-oriented NoSQL database management system used for storing data in flexible, JSON-like documents. Unlike some other SQL databases, MongoDB doesn’t use relational table-based structure.

    MongoDB is a very strong and powerful and flexible system that uses dynamic schemas in JSON-like documents called BSON, this makes it very fast and easy for data integration in different types of application. MongoDB is scalable and has high performance and availability for even large and complex infrastructures.

    Features of the Application

    The features of the Admin Dashboards include:

    • MongoDB database
    • Session-based authentication (Login and Registration)
    • SMTP Integration on signup and login
    • Gunicorn Deployment script (For Heroku)
    • Free SB-Admin 2 Dashboard Theme
    • Illustrations from Undraw.co

    Without further ado, let’s get into how this web application was built.

    Installations

    There are certain requirements needed to be able to create or run a Flask application. Some of these requirements are:

    • Python (Python 3 is what was used for this application)
    • Pip package manager

    Once you have these requirements installed on your laptop, you can go ahead to creating your Flask application.

    Setting up the Flask Application

    The first step to creating a Flask application would be to create a directory/folder where the files and folders of the application will be. To create a working directory go to your terminal and run:

    mkdir flask-admin
    cd flask-admin

    Running the line above creates the working directory and help you navigate into the directory.

    The next step is to create a virtual environment where our dependencies will be installed including our Flask package. To create and use a virtual environment, run the following lines in your terminal while in the working directory of your application:

    – Install the python virtual environment with pip:

    pip install virtualenv

    – Create a virtual environment for our application:

    virtualenv venv

    – Activate the virtual environment:

    source venv/bin/activate

    Having created and activated a virtual environment, we can then clone the Github repository of this application to install the required packages and also dive into the different sections of the application to understand how I built it.

    Read More:  22. Long Polling Chat, POST Reading. Pt 2.

    After cloning the application from GitHub, the next step is to install the packages in the requirements.txt file. Do that by running the following line in your terminal:

    pip install -r requirements.txt
    

    Setting up SMTP and MongoDB database servers

    There are a lot of mail server that can be used to send emails programmatically from our Flask application. In this application, I made use of Sendgrid, but you can make use of any mail server you are comfortable with.

    There is a package, Flask-Mail, that provides a plug and play implementation of SMTP in Python Flask. All you need to do is to install the package (it’s already included in the requirements.txt file) then provide the Mail Server, Mail port (it’s mostly usually either 465 or 587 depending on the security of the mail server), Mail username, Mail password(should never be stored in the application but rather as an environment variable with os.environ).

    As said earlier, MongoDB is the database used for this application because of its ease of use and speed for data integration. Because we plan to host the application, I created a MongoDB Atlas account on the MongoDB website and created a new database for this application online rather than setting up MongoDB locally on my machine. But if you don’t plan to host this application to the general public, you can set up MongoDB locally and create a database for the application.

    All dependencies are now installed and we’re almost ready to run our Flask Admin Dashboard :). Before we run our application, it’s important that we understand all the sections of the application and how these sections come together to make this application function well.

    Sections of the Application

    Here is the project structure of our Flask application:

    .
    ├── configuration
    │   └── __init__.py
    ├── helpers
    │   ├── database.py
    │   ├── hashpass.py
    │   └── mailer.py
    ├── model
    │   └── __init__.py
    ├── static
    │   ├── css
    │   ├── img
    │   ├── js
    │   ├── scss
    │   └── vendor
    ├── templates
    ├── views
    │   └── __init__.py
    ├── Procfile
    ├── app.py
    ├── requirements.txt
    │

    Right about now, I’ll explain each folder and the contents of the folder.

    1. Configuration: It contains an __init__.py file where you input the mail smtp and database credentials. For security purpose, you mustn’t store plain passwords in this file.
    2. Helpers: This contains 3 files that have some functions that help to run the application smoothly and easily.
      1. database.py: This is where the MongoDB database connection is initiated and an instance of the database is created for use across different parts of the application.
      2. hashpass.py: This file houses the function for hashing passwords of user that register on the admin dashboard. We don’t want to store plain password in our database, so a function is created to hash passwords with help of a python package, hashlib.
      3. mailer.py: This is the package that holds the function that sends mails with certain parameters (subject, sender, recipient, body) provided.
    3. Model: The model is where we have the different querying functions for user authentication and other necessary authentications to make the application run effectively.
    4. Static: This is the file directory for all the static contents of the application theme. The css, images, javascript files and folders are kept in the static folder.
    5. Templates: This houses all the html files of the application theme.
    6. Views: The views is where we have the routes and html renderer that displays the web application to the end-user it also has endpoints for the Ajax program used in this application (for user authentication on the front-end).
    7. app.py: This is the main file of the application from where the application is run.
    8. Profile: The procfile is an text file that holds the command(s) for the process types in the application (it is important as it makes the application run on a server).
    9. requirements.txt: This file stores the packages and their version. It helps other developers that want to work on the application install the right version of the python packages needed to run the application.
    Read More:  Git - Bad Practices

    Running the Application

    If you followed the article up to this point, then I believe you have successfully set up the application, you understand the application and you are ready to run the application.

    To run this flask application, navigate to your terminal with your virtual environment activated and run:

    python app.py

    You should see a url http:127.0.0.1:5000 provided to you in your terminal, open your preferred browser and navigate to that url or localhost:5000. You should see the login screen of the Admin Dashboard.

    The Flask Admin Login Page
    The Flask Admin Login Page

    To be able to access the main page/dashboard, you need to create an account. After creating an account, a mail will be sent to your registered email that you have successfully created an account on Flask Admin Boilerplate.

    This application has some javascript programs written with Jquery and Ajax to ensure that:

    1. Emails are unique and have not been used before
    2. Usernames are unique
    3. The password and confirm password match
    4. The username exists already before trying to login

    Once you have been able to login with your right credentials, you will be able to see the main page of the dashboard. You should have something like this:

    The Flask admin Dashboard page
    The Flask admin Dashboard page

    Hosting on Heroku

    To host this application on Heroku, go to Heroku website to create an account. Afterwards, create a new application.

    For easy deployment of our application, create a GitHub repository and push the application to the repo. Go to the deploy tab on your Heroku application dashboard and connect the GitHub repository you created to the application. It will build the application for some minutes and once it’s done building you’ll be able to view your deployed application on https://your-app-name.herokuapp.com.

     

    Finally, you can tweak and work your way around the web application. Fun fact: It’s absolutely open source and MIT Licensed.

    Find the code to this repo here and you can also click here to view the hosted application on Heroku.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Bukunmi

      Related Posts

      Mastering REST APIs: Essential Techniques for Programmers

      December 18, 2024

      Crafting Interactive User Interfaces Using JavaScript Techniques

      December 17, 2024

      Effective Strategies for Utilizing Frameworks in Web Development

      December 16, 2024
      Leave A Reply Cancel Reply

      You must be logged in to post a comment.

      Stay In Touch
      • Facebook
      • Twitter
      • Pinterest
      • Instagram
      • YouTube
      • Vimeo
      Don't Miss
      React December 24, 2020

      How to use the redux dev tools to speed up development and debugging

      Redux dev tools are development tools used to debug Redux-based applications. In this article, we’ll learn more about how this tool aids the development and debugging of applications.

      Quam Nulla Porttitor Massa Dneque Aliquam Vestibulum

      January 28, 2020

      Anime.js to MP4 and GIF with Node.js and FFMPEG

      April 25, 2023

      About Meteor.js

      August 17, 2016

      Categories

      • AI & Automation
      • Angular
      • ASP.NET
      • AWS
      • B2B Leads
      • Beginners
      • Blogs
      • Business Growth
      • Case Studies
      • Comics
      • Consultation
      • Content & Leadership
      • CSS
      • Development
      • Django
      • E-commerce & Retail
      • Entrepreneurs
      • Entrepreneurship
      • Events
      • Express.js
      • Facebook Ads
      • Finance & Fintech
      • Flask
      • Flutter
      • Franchising
      • Funnel Strategy
      • Git
      • GraphQL
      • Home Services Marketing
      • Influencer & Community
      • Interview
      • Java
      • Java Spring
      • JavaScript
      • Job
      • Laravel
      • Lead Generation
      • Legal & Compliance
      • LinkedIn
      • Machine Learning
      • Marketing Trends
      • Medical Marketing
      • MSP Lead Generation
      • MSP Marketing
      • NestJS
      • Next.js
      • Node.js
      • Node.js Lessons
      • Paid Advertising
      • PHP
      • Podcasts
      • POS Tutorial
      • Programming
      • Programming
      • Python
      • React
      • React Lessons
      • React Native
      • React Native Lessons
      • Recruitment
      • Remote Job
      • SaaS & Tech
      • SEO & Analytics
      • Soshace
      • Startups
      • Swarm Intelligence
      • Tips
      • Trends
      • Vue
      • Wiki
      • WordPress
      Top Posts

      Why Startups Fail? Part 2

      Startups October 5, 2016

      How to Take Control of Your Tech Interview | Take Charge in Three Easy Steps

      Interview March 22, 2019

      Google Algorithm Update: Recent Changes to SEO

      Beginners August 23, 2019

      Git – Recommendations for “Soshace” Team

      Git January 12, 2016

      Subscribe to Updates

      Get The Latest News, Updates, And Amazing Offers

      About Us
      About Us

      Soshace Digital delivers comprehensive web design and development solutions tailored to your business objectives. Your website will be meticulously designed and developed by our team of seasoned professionals, who combine creative expertise with technical excellence to transform your vision into a high-impact, user-centric digital experience that elevates your brand and drives measurable results.

      7901 4th St N, Suite 28690
      Saint Petersburg, FL 33702-4305
      Phone: 1(877)SOSHACE

      Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
      Our Picks
      Programming

      Best Practices for Writing Clean and Maintainable Code

      JavaScript

      React Lesson 15: Checking Homework progress from Lesson 14

      Programming

      Структура организации

      Most Popular

      Building a Telegram Bot with Node.js

      JavaScript

      Testing Laravel Applications Like a Pro with PHPUnit

      Laravel

      Express.js Lessons. Express: Basics and Middleware. Part 2.

      Programming
      © 2025 Soshace Digital.
      • Home
      • About
      • Services
      • Contact Us
      • Privacy Policy
      • Terms & Conditions

      Type above and press Enter to search. Press Esc to cancel.