🚀
AppSeed Docs
  • AppSeed
  • Support
  • App Generator
  • Boilerplate Code
    • API Servers
      • API Unified Definition
      • API Server Django
      • API Server Flask
      • API Server Node JS
    • Boilerplate Django Dashboards
    • Boilerplate Django Apps
    • Boilerplate Flask Dashboards
    • Boilerplate Flask Apps
    • Boilerplate Jinja
    • Django Templates
      • Django Template Volt
      • Django Argon Dashboard
      • Django Material Dashboard
  • Developer Tools
    • Django API Generator
    • Django Dynamic API
    • Django Dynamic DataTables
    • Flask Dynamic API
    • Flask Dynamic DataTables
    • DB Introspection Tool
  • PRODUCTS
    • Full-stack
      • Full-Stack React Purity
      • Full-Stack React Material
      • Full-Stack React Datta Able
      • Full-Stack React Berry
    • React
      • React Node JS Berry
      • React Node JS Datta Able
      • React Node JS Datta PRO
      • React Node Material Kit PRO
      • React Firebase Datta Able
      • React Firebase Datta PRO
      • Django React Datta Able
      • Django React Datta PRO
      • Flask React Datta Able
    • Flask Apps
      • Flask Material Kit
      • Flask Material Kit PRO
      • Flask Material Kit 2 PRO
      • Flask Pixel Lite
      • Flask Pixel PRO
      • Flask Soft Design
      • Flask Soft Design PRO
    • Flask Dashboards
      • Flask Adminator
      • Flask AdminLTE
      • Flask Azia Dashboard
      • Flask Argon Dashboard
      • Flask Argon PRO
      • Flask Atlantis Dark
      • Flask Atlantis Dark PRO
      • Flask Black Dashboard
      • Flask Black PRO
      • Flask CoreUI
      • Flask Datta Able
      • Flask Datta Able PRO
      • Flask Datta Able ENH
      • Flask Gradient Able
      • Flask Light Bootstrap
      • Flask Light Blue
      • Flask Material Dashboard
      • Flask Material PRO
      • Flask MaterialPro Lite
      • Flask MaterialPRO
      • Flask Material Admin
      • Flask Star Admin
      • Flask Soft Dashboard
      • Flask Soft Dashboard Pro
      • Flask Shards Dashboard
      • Flask SB Admin
      • Flask Sleek Admin
      • Flask Volt
      • Flask Volt PRO
      • Flask Tabler
    • Django Apps
      • Django Pixel Lite
      • Django Pixel PRO
      • Django Material Kit
      • Django Material Kit PRO
      • Django Material Kit 2 PRO
      • Django Soft Design
      • Django Soft Design PRO
    • Django Dashboards
      • Django Adminator
      • Django AdminLTE
      • Django Azia Dashboard
      • Django Argon Dashboard
      • Django Argon PRO
      • Django Atlantis Dark
      • Django Atlantis Dark PRO
      • Django Black Dashboard
      • Django Black PRO
      • Django CoreUI
      • Django Datta Able
      • Django Datta Able PRO
      • Django Datta Able ENH
      • Django Gradient Able
      • Django Light Bootstrap
      • Django Light Blue
      • Django Material Dashboard
      • Django Material PRO
      • Django MaterialPro Lite
      • Django MaterialPro
      • Django Star Admin
      • Django Soft Dashboard
      • Django Soft Dashboard PRO
      • Django Soft Dashboard ENH
      • Django Shards Dashboard
      • Django SB Admin
      • Django Volt
      • Django Volt PRO
      • Django Tabler
    • Eleventy 11ty
      • Soft UI Design
    • Jinja Templates
      • Jinja Argon Dashboard
      • Jinja AdminLTE
      • Jinja Atlantis Lite
      • Jinja Black Dashboard
      • Jinja Datta Able PRO
      • Jinja Dashkit v3
      • Jinja Light Bootstrap
      • Jinja Material Dashboard
      • Jinja Now UI Dashboard
      • Jinja Paper Dashboard
      • Jinja Pixel Lite
      • Jinja Pixel PRO
      • Jinja SB Admin
      • Jinja Volt Bootstrap 5
      • Jinja Volt PRO
  • Features
    • Flask
      • Extended User Model
  • Free Samples
    • Django Samples
      • Django Create Model
      • Django User Profile
      • Django Sales Charts
      • Django Routing Sample
      • Django API Server
  • Technologies
    • Django
      • Getting Started
      • Django v4 Release
    • FastAPI
      • Getting Started
    • Flask
      • Getting Started
      • Flask v2.0 Release
    • MySql
      • Install MySql on Windows
      • Install MySql on Ubuntu
    • Material UI
      • Getting Started
    • Next JS
      • Getting Started
      • Sample Next.js Project
      • Deploy a Next.js application on Netlify
      • Best Practices for NextJS projects
    • Python
      • Getting Started
    • Supabase
      • Getting Started
  • Deployment
    • Google Cloud Platform
      • Deploy Django on GCP
    • App Platform by DO
      • App Platform - Deploy Django
    • AWS - Amazon Services
      • Deploy Django on AWS
    • Render Deployment Platform
      • Deploy Flask to Render
      • Deploy Django to Render
      • Deploy React to Render
      • Deploy Django & React to Render
  • Content
    • What IS
      • What IS Apache
      • What IS Bulma
      • What IS Boilerplate Code
      • What IS CentOS
      • What IS Django
      • What IS Eleventy
      • What IS Flask
      • What IS Gunicorn
      • What IS Heroku
      • What IS JAMStack
      • What IS Jinja
      • What IS Nginx
      • What IS Panini
      • What IS Pipenv
      • What IS Python
      • What IS React
      • What IS Static Site
      • What IS Svelte
      • What IS Ubuntu
      • What IS uWsgi
      • What IS WSGI
      • Two-Tier Architecture
      • Single-Tier Architecture
      • N-Tier Architecture
    • Getting Started
      • Getting Started with Django
      • Django Templates
      • Getting Started with Flask
      • Getting Started with Next JS
    • How To
      • OAUth - Get Github Secrets
      • OAUth - Get Twitter Secrets
      • Crawl Website in Python
      • Setup CentOS for coding
      • Setup Ubuntu for coding
      • Setup Windows for coding
      • Install Pyhton
      • Install Pyhton 3.8 on Ubuntu
      • Install WSL
      • Install Docker on Windows
      • Getting Started with Python
      • Django Customize Admin UI
      • Django Chart Example
      • Django - Add Debug Toolbar
      • Django MySql Database
      • Django Dockerizing App
      • Django Reset Password
      • Django Extend User Model
      • Django Integrate DRF Library
      • Django Data Tables
      • Django Simple Charts
      • Django Social Login
      • Django Stripe Payments
      • Django HEROKU Deployment
      • Django AWS Deployment
      • Django Google Cloud Deploy
      • Django Azure Deployment
      • Install Flask
      • Code a simple app In Flask
      • Structure a Flask project
      • Flask Dockerizing App
      • Flask Reset Password
      • Flask User Profile
      • Flask Integrate Flask-RestX
      • Flask Data Tables
      • Flask Simple Charts
      • Flask Social Login
      • Flask Stripe Payments
      • Flask Deploy on Apache
      • Flask Deploy on HEROKU
      • Flask AWS Deployment
      • Flask Google Cloud Deploy
      • Flask Azure Deployment
      • How to Implement JWT Authentication in React
    • Tutorials
      • Django - How to Install
      • Django For Beginners
      • Django Request Object
      • Django Forms
      • Django Auth System
      • Flask - Code a simple App
      • Minimal Programming Kit
      • Parse HTML Components
    • Programming Languages
      • Php
      • Python
    • Frameworks
      • Django
      • Flask
    • Design Systems
      • Argon Design System
      • Soft UI Design System
    • Partners
      • BootstrapDash Agency
      • Creative-Tim Agency
      • CodedThemes Agency
      • CoreUI Agency
      • Themesberg Agency
      • WrapPixel Agency
    • Bootstrap Templates
      • Adminator
      • AdminKit
      • AdminLTE
      • Azia Dashboard PRO
      • Atlantis Lite Template
      • Atlantis PRO Template
      • Argon Dashboard Template
      • Argon Dashboard PRO
      • Black Dashboard Template
      • Black Dashboard PRO
      • CoreUI Template
      • Datta Able Template
      • Datta Able PRO Template
      • Light Bootstrap Template
      • Light Bootstrap PRO
      • Material Dashboard Template
      • Material Dashboard PRO
      • Material UI Kit
      • MaterialPro Lite
      • MaterialPro Wpx
      • Now UI Dashboard
      • Now UI Dashboard PRO
      • Paper Dashboard
      • Paper Dashboard PRO
      • Pixel Lite Template
      • Pixel PRO
      • Star Admin Template
      • Soft UI Dashboard
      • Soft UI Dashboard PRO
      • Shards Dashboard
      • Volt Dashboard Template
      • Volt Dashboard Pro Template
      • Tabler Template
    • Bulma CSS Templates
      • Dashkit PRO
      • Dashkit PRO v3
    • React Templates
      • Berry React Dashboard
      • CoreUI React
    • Vue Templates
      • Vuetify Material Dashboard
    • How to Fix
      • Cannot import name 'TextField' from 'wtforms'
      • ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security'
Powered by GitBook
On this page
  • ✨ Environment
  • ✨ Start the app in Docker
  • ✨ Manual Build
  • 👉 Set Up for Unix, MacOS
  • 👉 Set Up for Windows
  • APP Configuration via .env file
  • Flask environment variables (used in development)
  • DEBUG Flag
  • ASSETS_ROOT used in assets management
  • FTP Settings
  • MySql Credentials
  • Social Authentication via Github
  • Social Authentication via Twitter
  • ✨ Application Bootstrap Flow
  • ✨ API via Flask-RestX
  • Flask-RestX Intro
  • Exposed models
  • How to use the API
  • ✨ OAuth for Github and Twitter
  • Flask-Dance
  • OAuth via Github
  • OAuth via Twitter
  • 👉 Static Assets
  • 🚀 Where to go from here

Was this helpful?

  1. PRODUCTS
  2. Flask Dashboards

Flask Datta Able ENH

Dashboard built by AppSeed in Flask on top of Datta Able design - Manual Coded Version.

PreviousFlask Datta Able PRONextFlask Gradient Able

Last updated 2 years ago

Was this helpful?

This product is manualy coded on top of the generated version

Version: 1.0.13 - release date 2022-07-20

  • Bootstrap 5 Design, Light/Dark Mode, 190 pages, Multiple Layouts

  • DB Tools: SQLAlchemy ORM, Flask-Migrate (schema migrations)

  • Persistence: SQLite, MySql

  • Authentication: Session Based, Social Login via Github & Twitter

  • Users Management

    • Extended user profile

    • Complete Users management (for Admins)

  • API via Flask-RestX

  • Deployment: Docker, Flask-Minify (page compression)

Links

  • 👉 - product page

  • 👉 : Email and LIVE on

✨ Environment

To use the starter, should be installed properly in the workstation. If you are not sure if Python is installed, please open a terminal and type python --version. Here is the full list with dependencies and tools required to build the app:

  • Basic development tools (g++ compiler, python development libraries ..etc) used by Python to compile the app dependencies in your environment.

  • (Optional) Docker - a popular virtualization software

✨ Start the app in Docker

$ # Get the code
$ unzip flask-datta-able-enh.zip
$ cd flask-datta-able-enh

👉 Step 2 - Start the APP in Docker

$ docker-compose up --build 

Visit http://localhost:5085 in your browser. The app should be up & running

✨ Manual Build

$ # Get the code
$ unzip flask-datta-able-enh.zip
$ cd flask-datta-able-enh

👉 Set Up for Unix, MacOS

Install modules via VENV

$ virtualenv env
$ source env/bin/activate
$ pip3 install -r requirements.txt

Set Up Flask Environment

$ export FLASK_APP=run.py
$ export FLASK_ENV=development

Set Up Database

# Init migration folder
$ flask db init # to be executed only once         
$ flask db migrate # Generate migration SQL
$ flask db upgrade # Apply changes

Create super admin (the superuser account)

$ flask create_admin

Start the app

$ flask run

At this point, the app runs at http://127.0.0.1:5000/.

👉 Set Up for Windows

Install modules via VENV (windows)

$ virtualenv env
$ .\env\Scripts\activate
$ pip3 install -r requirements.txt

Set Up Flask Environment

$ # CMD 
$ set FLASK_APP=run.py
$ set FLASK_ENV=development
$
$ # Powershell
$ $env:FLASK_APP = ".\run.py"
$ $env:FLASK_ENV = "development"

Set Up Database

# Init migration folder
$ flask db init # to be executed only once         
$ flask db migrate # Generate migration SQL
$ flask db upgrade # Apply changes

Create super admin (the superuser account)

$ flask create_admin

Start the app

$ flask run

At this point, the app runs at http://127.0.0.1:5000/.

APP Configuration via .env file

Rename env.sample to .env and edit the variables:

Flask environment variables (used in development)

  • FLASK_APP=run.py - run.py is the entry point in the project

  • FLASK_ENV=development

DEBUG Flag

  • DEBUG: if True the SQLite persistence is used.

    • For production use False = this will switch to MySql persistence

ASSETS_ROOT used in assets management

  • default value: /static/assets

FTP Settings

This section, once defined, the user is able to change their profile photo. To test the connection, run flask test_ftp.

  • FTP_SERVER - ftp server address

  • FTP_USER - ftp user

  • FTP_PASSWORD - ftp password

  • FTP_WWW_ROOT - the public address used for uploaded assets

MySql Credentials

This section is used when DEBUG is set to False (production mode)

  • DB_ENGINE, default value = mysql

  • DB_NAME, default value = appseed_db

  • DB_HOST, default value = localhost

  • DB_PORT, default value = 3306

  • DB_USERNAME, default value = appseed_db_usr

  • DB_PASS, default value = pass

Social Authentication via Github

When credentials are defined, the app enables the LOGIN with Github button on Sign IN page.

  • GITHUB_ID=YOUR_GITHUB_ID

  • GITHUB_SECRET=YOUR_GITHUB_SECRET

Social Authentication via Twitter

When credentials are defined, the app enables the LOGIN with Twitter button on Sign IN page.

  • TWITTER_ID=YOUR_GITHUB_ID

  • TWITTER_SECRET=YOUR_GITHUB_SECRET

✨ Application Bootstrap Flow

The entry point of the project is the run.py file where the project configuration is bundled. The most important files that make the project functional are listed below:

  • run.py is the application entry point

    • read the Debug flag from .env

    • import the db object from apps package

    • import the create_app helper from apps

  • Flask application is built by create_app

    • If Debug=True - SQLite is used (development mode)

    • If Debug=False - SQLite is used (production mode)

  • Configuration

    • is defined in apps/config.py

✨ API via Flask-RestX

API stands for Application Programming Interface and it is used by various programs to communicate. When browsing the internet, you are using an API. The API takes your request, sends it to the service provider, fetches the response, and sends it back to you.

Flask-RestX Intro

Flask-RestX is an extension for Flask that allows us to build REST APIs faster. It has a collection of tools and decorators to help you describe and expose your API to the Swagger documentation.

The Swagger UI: http://localhost:5000/api/

Exposed models

Products API

  • Definition: apps/models/: Product Class

  • Definition: id, name, information, description, price, currency

  • URI: http://localhost:5000/api/products/

Sales API

  • Definition: apps/models/: Sale Class

  • Definition: id, product, state, value, fee, currency, client, payment_type, purchase_date

  • URI: http://localhost:5000/api/products/

How to use the API

The API is secured via an api_token generated during the registration process. The value is saved in the Users table. Once the user is authenticated, the API_TOKEN is listed on the dashboard.

  • GET requests can be used without the API_TOKEN

  • All mutating requests (PUT, DELETE, POST) requires the presence of the API_TOKEN in the header: Authorization field

Swagger UI

  • This visual tool is exposed at address http://localhost:5000/api/ and provides a fast access to the API

POSTMAN (3rd party tools)

  • Replace the Authorization value with the API KEY listed on your dashboard

  • Query the PRODUCTS API

    • create, update and delete products

  • Query the SALES API

    • create, update and delete sales

\

✨ OAuth for Github and Twitter

Open Authorization (OAuth) is an authorization framework designed to allow third-party applications to access a user's data or resource. With this protocol, you can sign up and log in via social accounts like GitHub and Twitter.

Flask-Dance

Flask-Dance is an extension that allows developers to create Flask-based applications with the option of authenticating via the OAuth protocol.

OAuth via Github

To authenticate via GitHub, we must define our credentials in the .env file.

  • GITHUB_ID=YOUR_GITHUB_ID

  • GITHUB_SECRET=YOUR_GITHUB_SECRET

To get the credentials above;

  1. Go to your GitHub account, navigate to Settings -> Developer Settings -> OAuth Apps

  2. Edit the OAuth such that

  • Call back URL: https://localhost:5000/login/github/authorized

  • Homepage URL: https://localhost:5000

Once done, generate a secret key, and copy & paste it into the .env file. Do the same for the Client Id generated by GitHub.

Run the app using HTTPS

$ flask run --cert=adhoc

You can log in via the GitHub button.

OAuth via Twitter

To authenticate via Twitter, we must define our credentials in the .env file.

  • Sign IN to Twitter

  • Go to the Developer Section

  • Create a new APP

  • Edit settings

  • Check OAuth version: v1 or v2 (recommended)

  • Callback URL: https://localhost:5000/login/twitter/authorized

Edit the .env file and run the app using HTTPS

  • TWITTER_ID=YOUR_TWITTER_ID

  • TWITTER_SECRET=YOUR_TWITTER_SECRET

$ flask run --cert=adhoc

You can log in via the Twitter button.

👉 Static Assets

The static assets used by the project (JS, CSS, images) are saved inside the apps/static/assets folder. This path can be customized with ease via ASSETS_ROOT variable saved in the .env file.

How it works

  • .env defines the ASSETS_ROOT variable

  • apps/config.py read the value of ASSETS_ROOT and defaults to /static/assets if not found:

# content of apps/config.py (truncated content)

ASSETS_ROOT = os.getenv('ASSETS_ROOT', '/static/assets') 
  • All pages and components use the config.ASSETS_ROOT variable. Here is a sample extracted from templates/layouts/base.html:

<head>

    <!-- Source Code -->
    <link rel="stylesheet" href="{{ config.ASSETS_ROOT }}/css/style.css">

    <!-- RUNTIME -->
    <link rel="stylesheet" href="/static/assets/css/style.css">

At runtime, the href property is resolved to /static/assets/css/style.css based on the value saved in the .env file:

# No Slash at the end
ASSETS_ROOT=/static/assets

🚀 Where to go from here

- the programming language used to code the app

- used to clone the source code from the Github repository

👉 Step 1 - Access the and download the ZIP (requires a purchase)

Download the code - access the and download the ZIP (requires a purchase)

Import the sample (saved on Github)

👉 Access the page in case something is missing

👉 Use to generate a new project

Datta Able PRO
Datta Able Flask PRO
Support
Discord
Python3
Python3
GIT
product page
product page
POSTMAN collection
support
Datta Able Generator
Oauth via GitHUB