Giter VIP home page Giter VIP logo

flaskapp's Introduction

Flask Seed App

Requirements Status devDependency Status

This app is meant to serve as template for new projects. It has the following features:

  • User accounts implemented with SQLite, cookies and Flask-Login
  • Passwords hashed with bcrypt
  • CSRF protection with Flask-CSRF
  • Email with Flask-Mail
  • Login/logout/forgot password workflow
  • Static asset build step with gulp
  • Basic HTML Web and Email templates with MUI (https://www.muicss.com)
  • Unittests

To create a new app from flaskapp first clone the repository and remove the .git directory:

$ git clone [email protected]:muicss/flaskapp.git
$ rm -rf flaskapp/.git

Then, do a search-replace on the string flaskapp (remember to replace <name> with your app's name):

$ find flaskapp -type f | xargs sed -i'' -e 's/flaskapp/<name>/g'
$ find flaskapp -type f | xargs sed -i'' -e 's/Flaskapp/<Name>/g'
$ mv flaskapp <name>
$ mv <name>/flaskapp <name>/<name>

Now you have your own flask seed project.

Config Variables

flaskapp can be configured using the following environment variables:

Name Description Default Required
DEBUG Flask debug variable "False" no
SECRET_KEY Flask cookie encryption key null yes
MAIL_PORT SMTP port null yes
MAIL_SERVER SMTP hostname null yes
MAIL_USERNAME SMTP username null yes
MAIL_PASSWORD SMTP password null yes

Quickstart

To work in a sandboxed Python environment we recommend installing the app in a Python virtualenv.

  1. Install dependencies

    $ cd /path/to/flaskapp
    $ pip install -r requirements.txt
  2. Setup a SQLite database for development (app.db)

    $ python scripts/create_db.py
  3. Environment variables

    In order to configure flaskapp it is recommended that you create an environment file with the required variables listed above:

    #!/bin/bash
    # Environment variables for Flask seed app
    
    export DEBUG="True"
    export SECRET_KEY="replaceme"
    export MAIL_PORT="587"
    export MAIL_SERVER="mail.google.com"
    export MAIL_USERNAME="[email protected]"
    export MAIL_PASSWORD="replaceme"

    To add the variables to your environment you can source the file as part of your normal workflow:

    $ source /path/to/env-vars.sh
  4. Run development server

    $ python wsgi.py

    View at http://127.0.0.1:5000

  5. Frontend build scripts

    Install node dependencies:

    $ cd /path/to/flaskapp/static-src
    $ npm install

    Run gulp:

    $ npm run build

Unittests

To run all tests:

$ nosetests

To run an individual test:

$ nosetests tests/views/test_content.py

Contribute

Contributions are welcome! If you'd like to report an issue or submit a pull request please use our github page: https://github.com/muicss/flaskapp.

flaskapp's People

Contributors

amorey avatar

Watchers

James Cloos avatar

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.