cookiecutter-flask

授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发、 常用JavaScript包
软件类型 开源软件
地区 不详
投 递 者 华谭三
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

cookiecutter-flask

A Flask template for cookiecutter. (Supports Python ≥ 3.6)

CodeQL

See this repo for an example project generated from the most recent version of the template.

Use it now

Docker (This is the preferred method for creating a new project)

# Basic usage (You will be prompted to provide basic information about your application)
$ ./cookiecutter-docker.sh
    full_name [Steven Loria]:

# Additional arguments are available
$ ./cookiecutter-docker.sh --help
    Usage: ./cookiecutter-docker.sh [OPTIONS]

Options:
    -b, --build    Build Docker image before running cookiecutter
    -t, --template Specify custom cookiecutter template via a URI to a git repo
                    e.g. https://github.com/cookiecutter-flask/cookiecutter-flask.git
                    Defaults to template in current working directory
    -h, --help     Show this message and exit

Standard

If using standard instructions, Python ≥ 3.6 is required. A virtual environment is recommended (like virtualenv).

pip3 install cookiecutter
cookiecutter https://github.com/cookiecutter-flask/cookiecutter-flask.git

You will be asked about your basic info (name, project name, app name, etc.). This info will be used in your new project.

Configure and Run

After you have generated the project code, a few more steps must be taken before your new app will run. The README of the generated project shows you how to configure and run the application. (You can see the template README here).

Features

  • Bootstrap 4 and Font Awesome 4 with starter templates
  • Flask-SQLAlchemy with basic User model
  • Easy database migrations with Flask-Migrate
  • Configuration in environment variables, as per The Twelve-Factor App
  • Flask-WTForms with login and registration forms
  • Flask-Login for authentication
  • Flask-Bcrypt for password hashing
  • Procfile for deploying to a PaaS (e.g. Heroku)
  • pytest and Factory-Boy for testing (example tests included)
  • Flask's Click CLI configured with simple commands
  • CSS and JS minification using webpack
  • npm support for frontend package management
  • Caching using Flask-Cache
  • Useful debug toolbar
  • Utilizes best practices: Blueprints and Application Factory patterns

Screenshots

Home page

Home page

Inspiration

License

MIT licensed.

Changelog

Unreleased

  • Update all node dependencies to latest versions
  • Switch to using Github Actions for template CI
  • Remove support for Node 10 as a Cookiecutter option
  • Refactored Docker image to use multistage builds more efficiently
  • Projects generated with the template use Github actions for CI
  • Upgrade Webpack to 5.x

18.0.0 (09/09/2018)

  • Use CalVer (YY.MINOR.MICRO).
  • Upgrade to Bootstrap 4. Thanks @adawalli and @Hiyorim.
  • Use environment variables for configuration.
  • Add support for Pipenv.
  • Upgrade Python and Node dependencies.

0.13.0 (06/25/2017)

  • Use webpack for building front-end assets. Front-end dependencies areinstalled with NPM. Remove Flask-Assets and bower.json. Thanks@wroberts.

0.12.0 (11/06/2016)

  • Update Python dependencies.

0.11.1 (11/06/2016)

  • Correctly pass first parameter to Flask according to the 0.11 docs. Thanks @aliavni.
  • Remove setuptools and wheel as dependencies to fix deployment on Heroku. Thanks @Cabalist.
  • Make User.password a Binary field for compatibility with new versions of bcrypt. Thanks again @Cabalist.

0.11.0 (09/10/2016)

  • Use the FLASK_DEBUG system environment variable, instead of MYFLASKAPP_ENV, to control different configs for development and production environments

0.10.1 (08/28/2016)

  • Fix invoke test command.

0.10.0 (08/28/2016)

  • Update to Flask 0.11.
  • Use Click instead of Flask-Script for CLI commands.

0.9.0 (03/06/2016)

  • Update stale requirements.
  • Add CSRF protection.
  • Run lint command on Travis builds.
  • Test against Python 3.5.

0.8.0 (11/09/2015)

  • Update stale requirements.
  • Add lint, clean, and urls management commands.
  • Add isort.

Thanks @andreoliw for these contributions.

0.7.0 (04/14/2015)

  • Update extension import style to flask_* as per mitsuhiko/flask#1135.
  • Update stale requirements (Werkzeug, Flask-WTF, WTForms, Flask-Bcrypt, Flask-DebugToolbar, Flask-Migrate, Bootstrap, jQuery). Thanks @bsmithgall for notifying me of the critical patch to Flask-Migrate.

0.6.0 (12/01/2014)

  • Test the cookiecutter on Travis. Thanks @joshfriend.
  • Update stale requirements (Flask-WTF, Flask-Migrate, Flask-DebugToolbar)

0.5.0 (09/29/2014)

  • Fix .travis.yml.
  • Update stale requirements (Flask-WTF, WTForms, Flask-SQLAlchemy, jquery, Bootstrap)

0.4.3 (07/27/2014)

  • Add BaseFactory class.
  • Add compat.py module.
  • Tests pass on Python 3.

0.4.2 (07/27/2014)

  • Update factories to factory-boy >= 2.4.0 syntax.
  • Update stale requirements.

0.4.1 (06/07/2014)

  • Update stale requirements (Werkzeug 0.9.6, WTForms 2.0)
  • Fix unmatched div tag in home.html (thanks @level09)

0.4.0 (04/19/2014)

  • Add ReferenceCol for less verbose foreign key columns.
  • Add SurrogatePK mixin for adding integer primary key to a model.
  • Add base Model class that has CRUD convenience methods.
  • Fix setting BCrypt encryption complexity. Tests are much faster.
  • Add Role model to show ReferenceCol usage.
  • Switch to pytest.
  • Upgrade all out-of-date requirements.
  • More test examples.
  • Remove "year" from cookiecutter.json (just change LICENSE if necessary).

0.3.2 (02/26/2014)

  • Fix static assets.

0.3.1 (02/20/2014)

  • Update default year in cookiecutter.json. Thanks @Omeryl
  • Correct testing of redirects in webtests. Thanks @Widdershin
  • Fix POST action in nav form. Thanks @Widdershin.
  • Update Bootstrap (3.1.1) and jQuery (2.1.0)
  • Optional support for bower.
  • Minified assets aren't used in dev environment.

0.3.0 (12/08/2013)

  • More modular organization: each blueprint contains its own view, models, and forms in a directory. There is still a single directory for templates and static assets.
  • Use Flask-Bcrypt for password hashing.
  • Flask-Login for authentication.
  • Simple test setup. Just create a subclass of DbTestCase.
  • Flask-Testing support.
  • Use Factory-Boy for test factories.
  • Use WebTest for functional testing.
  • Add Flask-Debugtoolbar.
  • Migrations using Flask-Migrate.
  • Caching using Flask-Cache.
  • Add error page templates (404, 401, 500)
  • Add Font Awesome 4.0.3 for icons.

0.2.0 (09/21/2013)

  • Add manage.py script
  • Add Flask-Assets for CSS and JS bundling+minification
  • Use different configs for development and production environments, controlled by the MYFLASKAPP_ENV system environment variable
  • Use Blueprints and application factory pattern. The simple branch does not use these.

0.1.0 (08/20/2013)

  • First iteration
  • Bootstrap 3 final
  • Working User model and registration
  • 关于cookiecutter-flask Cookiecutter可以让你快速从模板中建立工程,cookiecutter-flask则是Flask的模板,可以快速生成Flask大型项目模板。 cookiecutter-flask生成的工程目录下有一个database.py文件,主要是对数据表功能的一个扩展。这篇文章是对这份代码简单分析。上代码 database.py # -*- coding: u

  • 前言 Python必学的两大web框架之一Flask,俗称微框架。它只需要一个文件,几行代码就可以完成一个简单的http请求服务。 但是我们需要用flask来提供中型甚至大型web restful api服务的时候就需要我们来规划项目结构。 Django 框架有自身的生成项目结构的命令和生成app的命令,但是Flask没有。 这篇文章主要介绍使用工具帮助我们进行一些Flask rest api项目

  • Flask路由可以指定HTTP请求方法,并在请求函数中根据不同的请求方法,执行不同的逻辑。这样实现一个Restful的请求已经相当简单了 Flask还有更简便的方法,就是其Flask-RESTful扩展。首先,我们来安装这个扩展: pip install Flask-RESTful 安装完后,你就可以在代码中导入该扩展包 from flask import Flask, request from

  • 在创建的虚拟环境中安装cookiecutter $VENV/bin/pip install cookiecutter $ $ENV/bin/cookiecutter gh:Pylons/pyramid-cookiecutter-starter --checkout 1.10-branch 此处输入你所创建项目的名称 project_name [Pyramid Scaffold]: proj

  • 最近还是要写项目在CICC,做一个和前端交互的Flask项目,然后干脆学习一下怎么做架构师。 看看Flask项目全家桶的内容。 除了下面写的,在github上还有https://github.com/humiaozuzu/awesome-flask等awesome系列可以拿着用 flask已经集成的Flask-WTF,表单使用 Flask-Mail邮件插件,狗书里的内容 Flask-Cache :

 相关资料
  • Cookiecutter 是一款快速建立工程模板的Python命令行工具。它可以让你快速从模板中建立工程,目前有 Python、C、Common Lisp、JS、LaTeX/XeTeX、Berkshelf-Vagrant 和 HTML 的模板。 从 cookiecutter-pypackage.git 中的模板创建工程,你可以输入一些值, 然后它会在当前工作目录下为你创建一些 Python 包。

  • cookiecutter-flask-restful Cookiecutter template for flask restful, including blueprints, application factory, and more Introduction This cookie cutter is a very simple boilerplate for starting a REST

  • Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstartingproduction-ready Django projects quickly. Documentation: https://cookiecutter-django.readthedocs.io/en/l

  • Cookiecutter Django-Vue Powered by Cookiecutter,inspired by Cookiecutter Django. Features Docker 12 Factor Server: Nginx Frontend: Vue + vue-cli + PWA Backend: Django Database: PostgreSQL API: REST or

  • Table of Contents This article consists of the following sections. Table of Contents Features Introduction Requirements Quick start Initial directories and files Makefile targets Working with Docker c

  • cookiecutter-django-rest a factory for building bleeding edge, best practiced, scalable, rest apis You need to make a scalable api on a deadline. You deeply care about the quality of your work.cookiec