All Projects → hack4impact → Flask Base

hack4impact / Flask Base

Licence: mit
A simple Flask boilerplate app with SQLAlchemy, Redis, User Authentication, and more.

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
Dockerfile
14818 projects
SCSS
7915 projects
shell
77523 projects

Projects that are alternatives of or similar to Flask Base

Flask Boilerplate
Simple flask boilerplate with Postgres, Docker, and Heroku/Zeit now
Stars: ✭ 251 (-90.63%)
Mutual labels:  sqlalchemy, database, flask, boilerplate
Enferno
A Python framework based on Flask microframework, with batteries included, and best practices in mind.
Stars: ✭ 385 (-85.63%)
Mutual labels:  sqlalchemy, redis, flask
Ziggurat foundations
Framework agnostic set of sqlalchemy classes that make building applications that require permissions an easy task.
Stars: ✭ 67 (-97.5%)
Mutual labels:  sqlalchemy, flask, authentication
Express Graphql Mongodb Boilerplate
A boilerplate for Node.js apps / GraphQL-API / Authentication from scratch - express, graphql - (graphql compose), mongodb (mongoose).
Stars: ✭ 288 (-89.25%)
Mutual labels:  redis, authentication, boilerplate
Express Mongodb Rest Api Boilerplate
A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose).
Stars: ✭ 153 (-94.29%)
Mutual labels:  redis, authentication, boilerplate
Lad
👦 Lad is the best Node.js framework. Made by a former Express TC and Koa team member.
Stars: ✭ 2,112 (-21.19%)
Mutual labels:  redis, boilerplate
Proxy pool
Python爬虫代理IP池(proxy pool)
Stars: ✭ 13,964 (+421.04%)
Mutual labels:  redis, flask
Autoline
建议你使用更新的AutoLink平台
Stars: ✭ 227 (-91.53%)
Mutual labels:  sqlalchemy, flask
Angular 8 Registration Login Example
Angular 8 User Registration and Login Example
Stars: ✭ 198 (-92.61%)
Mutual labels:  authentication, boilerplate
Flask Msearch
Full text search for flask.
Stars: ✭ 164 (-93.88%)
Mutual labels:  sqlalchemy, flask
Bottle Cork
Authentication module for the Bottle and Flask web frameworks
Stars: ✭ 174 (-93.51%)
Mutual labels:  flask, authentication
Express Graphql Boilerplate
Express GraphQL API with JWT Authentication and support for sqlite, mysql, and postgresql
Stars: ✭ 201 (-92.5%)
Mutual labels:  authentication, boilerplate
Clickhouse Sqlalchemy
ClickHouse dialect for SQLAlchemy
Stars: ✭ 166 (-93.81%)
Mutual labels:  sqlalchemy, database
Docker Flask Celery Redis
Docker-Compose template for orchestrating a Flask app with a Celery queue using Redis
Stars: ✭ 165 (-93.84%)
Mutual labels:  redis, flask
Pytest Flask Sqlalchemy
A pytest plugin for preserving test isolation in Flask-SQLAlchemy using database transactions.
Stars: ✭ 168 (-93.73%)
Mutual labels:  sqlalchemy, flask
Flusk
Boilerplate API on how to structure big Flask applications (includes SQLAlchemy, Docker, nginx)
Stars: ✭ 165 (-93.84%)
Mutual labels:  sqlalchemy, flask
Choochoo
Training Diary
Stars: ✭ 186 (-93.06%)
Mutual labels:  sqlalchemy, database
Endb
Key-value storage for multiple databases. Supports MongoDB, MySQL, Postgres, Redis, and SQLite.
Stars: ✭ 208 (-92.24%)
Mutual labels:  database, redis
Proxypool
An Efficient ProxyPool with Getter, Tester and Server
Stars: ✭ 3,050 (+13.81%)
Mutual labels:  redis, flask
Eve Sqlalchemy
SQLAlchemy data layer for Eve-powered RESTful APIs
Stars: ✭ 215 (-91.98%)
Mutual labels:  sqlalchemy, flask

flask-base

Circle CI Code Climate Issue Count python3.x python2.x

flask-base

A Flask application template with the boilerplate code already done for you.

Documentation available at http://hack4impact.github.io/flask-base.

What's included?

  • Blueprints
  • User and permissions management
  • Flask-SQLAlchemy for databases
  • Flask-WTF for forms
  • Flask-Assets for asset management and SCSS compilation
  • Flask-Mail for sending emails
  • gzip compression
  • Redis Queue for handling asynchronous tasks
  • ZXCVBN password strength checker
  • CKEditor for editing pages

Demos

Home Page:

home

Registering User:

registering

Admin Editing Page:

edit page

Admin Editing Users:

edit user

Setting up

Create your own repository from this Template

Navigate to the main project page and click the big, green "Use this template" button at the top right of the page. Give your new repository a name and save it.

Clone the repository
$ git clone https://github.com/YOUR_USERNAME/REPO_NAME.git
$ cd REPO_NAME
Initialize a virtual environment

Windows:

$ python3 -m venv venv
$ venv\Scripts\activate.bat

Unix/MacOS:

$ python3 -m venv venv
$ source venv/bin/activate

Learn more in the documentation.

Note: if you are using a python before 3.3, it doesn't come with venv. Install virtualenv with pip instead.

(If you're on a Mac) Make sure xcode tools are installed
$ xcode-select --install
Add Environment Variables

Create a file called config.env that contains environment variables. Very important: do not include the config.env file in any commits. This should remain private. You will manually maintain this file locally, and keep it in sync on your host.

Variables declared in file have the following format: ENVIRONMENT_VARIABLE=value. You may also wrap values in double quotes like ENVIRONMENT_VARIABLE="value with spaces".

  1. In order for Flask to run, there must be a SECRET_KEY variable declared. Generating one is simple with Python 3:

    $ python3 -c "import secrets; print(secrets.token_hex(16))"
    

    This will give you a 32-character string. Copy this string and add it to your config.env:

    SECRET_KEY=Generated_Random_String
    
  2. The mailing environment variables can be set as the following. We recommend using Sendgrid for a mailing SMTP server, but anything else will work as well.

    MAIL_USERNAME=SendgridUsername
    MAIL_PASSWORD=SendgridPassword
    

Other useful variables include:

Variable Default Discussion
ADMIN_EMAIL [email protected] email for your first admin account
ADMIN_PASSWORD password password for your first admin account
DATABASE_URL data-dev.sqlite Database URL. Can be Postgres, sqlite, etc.
REDISTOGO_URL http://localhost:6379 Redis To Go URL or any redis server url
RAYGUN_APIKEY None API key for Raygun, a crash and performance monitoring service
FLASK_CONFIG default can be development, production, default, heroku, unix, or testing. Most of the time you will use development or production.
Install the dependencies
$ pip install -r requirements.txt
Other dependencies for running locally

You need Redis, and Sass. Chances are, these commands will work:

Sass:

$ gem install sass

Redis:

Mac (using homebrew):

$ brew install redis

Linux:

$ sudo apt-get install redis-server

You will also need to install PostgresQL

Mac (using homebrew):

brew install postgresql

Linux (based on this issue):

sudo apt-get install libpq-dev
Create the database
$ python manage.py recreate_db
Other setup (e.g. creating roles in database)
$ python manage.py setup_dev

Note that this will create an admin user with email and password specified by the ADMIN_EMAIL and ADMIN_PASSWORD config variables. If not specified, they are both [email protected] and password respectively.

[Optional] Add fake data to the database
$ python manage.py add_fake_data

Running the app

$ source env/bin/activate
$ honcho start -e config.env -f Local

For Windows users having issues with binding to a redis port locally, refer to this issue.

Gettin up and running with Docker and docker-compose:

Clone the repository
$ git clone https://github.com/YOUR_USERNAME/REPO_NAME.git
$ cd REPO_NAME
Create and run the images:
$ docker-compose up
Create database and initial data for development:
$ docker-compose exec server ./init_database.sh

It will deploy 5 docker images:

  • server: Flask app running in http://localhost:5000.
  • worker: Worker ready to get tasks.
  • postgres: Postgres SQL isolated from the app.
  • adminer: Web client for database management, running in http://localhost:8080.
  • redis: Redis SQL isolated from the app

Formatting code

Before you submit changes to flask-base, you may want to autoformat your code with python manage.py format.

Contributing

Contributions are welcome! Please refer to our Code of Conduct for more information.

Documentation Changes

To make changes to the documentation refer to the Mkdocs documentation for setup.

To create a new documentation page, add a file to the docs/ directory and edit mkdocs.yml to reference the file.

When the new files are merged into master and pushed to github. Run mkdocs gh-deploy to update the online documentation.

Related

https://medium.freecodecamp.com/how-we-got-a-2-year-old-repo-trending-on-github-in-just-48-hours-12151039d78b#.se9jwnfk5

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].