Giter Club home page Giter Club logo

flask-starter's Introduction

Flask-Starter

Flask-Starter is a boilerplate starter template designed to help you quickstart your Flask web application development. It has all the ready-to-use bare minimum essentials.

Features

  • Flask 2.0, Python (PEP8)
  • Signup, Login with (email, password)
  • Forget/reset passwords
  • Email verification
  • User profile/password updates
  • User roles (admin, user, staff)
  • User profile status (active, inactive)
  • Admin dashboard for management
  • Contact us form
  • Basic tasks/todo model (easily replace with your use-case)
  • Bootstrap template (minimal)
  • Utility scripts (initiate dummy database, run test server)
  • Test & Production Configs
  • Tests [To Do]

Flask 2.0 async or not async

  • asynchronous support in Flask 2.0 is an amazing feature
  • however, use it only when it has a clear advantage over the equivalent synchronous code
  • write asynchronous code, if your application's routes, etc. are making heavy I/O-bound operations, like:
    • sending emails, making API calls to external servers, working with the file system, etc
  • otherwise, if your application is doing CPU-bound operations or long-running tasks, like:
    • processing images or large files, creating backups or running AI/ML models, etc
    • it is advised to use tools like "Celery" or "Huey", etc.

async demo in our application

Check emails/__init__.py to see how emails being sent in async mode

Primary Goals

  • To help you save lots of hours as a developer, even if for a hobby project or commercial project :-)
  • To provide basic features of standard web apps, while staying as unopinionated as possible
  • To make back-end development quick to start, with robust foundations
  • To help you quickly learn how to build a Flask based web application
  • To help you quick start coding your web app's main logic and features

Table of Contents

  1. Getting Started
  2. Screenshots
  3. Project Structure
  4. Modules
  5. Testing
  6. Need Help?

Getting Started

clone the project

$ git clone https://github.com/ksh7/flask-starter.git
$ cd flask-starter

create virtual environment using python3 and activate it (keep it outside our project directory)

$ python3 -m venv /path/to/your/virtual/environment
$ source <path/to/venv>/bin/activate

install dependencies in virtualenv

$ pip install -r requirements.txt

setup flask command for our app

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

create instance folder in /tmp directory (sqlite database, temp files stay here)

$ mkdir /tmp/flaskstarter-instance

initialize database and get two default users (admin & demo), check manage.py for details

$ flask initdb
  1. start test server at localhost:5000
$ flask run

Screenshots

Homepage SignUp Login Dashboard Tasks Profile Admin

Project Structure

flask-starter/
├── flaskstarter
│   ├── app.py
│   ├── config.py
│   ├── decorators.py
│   ├── emails
│   │   └── __init__.py
│   ├── extensions.py
│   ├── frontend
│   │   ├── forms.py
│   │   ├── __init__.py
│   │   ├── models.py
│   │   └── views.py
│   ├── __init__.py
│   ├── settings
│   │   ├── forms.py
│   │   ├── __init__.py
│   │   └── views.py
│   ├── static
│   │   ├── bootstrap.bundle.min.js
│   │   ├── bootstrap.min.css
│   │   └── jquery.slim.min.js
│   ├── tasks
│   │   ├── forms.py
│   │   ├── __init__.py
│   │   ├── models.py
│   │   └── views.py
│   ├── templates
│   │   ├── admin
│   │   │   └── index.html
│   │   ├── dashboard
│   │   │   └── dashboard.html
│   │   ├── frontend
│   │   │   ├── change_password.html
│   │   │   ├── contact_us.html
│   │   │   ├── landing.html
│   │   │   ├── login.html
│   │   │   ├── reset_password.html
│   │   │   └── signup.html
│   │   ├── layouts
│   │   │   ├── base.html
│   │   │   └── header.html
│   │   ├── macros
│   │   │   ├── _confirm_account.html
│   │   │   ├── _flash_msg.html
│   │   │   ├── _form.html
│   │   │   └── _reset_password.html
│   │   ├── settings
│   │   │   ├── password.html
│   │   │   └── profile.html
│   │   └── tasks
│   │       ├── add_task.html
│   │       ├── edit_task.html
│   │       ├── my_tasks.html
│   │       └── view_task.html
│   ├── user
│   │   ├── constants.py
│   │   ├── __init__.py
│   │   └── models.py
│   └── utils.py
├── manage.py
├── README.md
├── requirements.txt
├── screenshots
└── tests
    ├── __init__.py
    └── test_flaskstarter.py

Modules

This application uses the following modules

  • Flask
  • Flask-SQLAlchemy
  • Flask-WTF
  • Flask-Mail
  • Flask-Caching
  • Flask-Login
  • Flask-Admin
  • pytest
  • Bootstrap (bare minimum so that you can replace it with any frontend library)
  • Jinja2

Testing

Note: This web application has been tested thoroughly during multiple large projects, however tests for this bare minimum version would be added in tests folder very soon to help you get started.

Need Help? 🤝

If you need further help, reach out to me via Twitter DM.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.