Skip to content

xiongxianzhu/cookiecutter-flask

Repository files navigation

cookiecutter-flask

Cookiecutter可以让你快速从模板中建立工程,cookiecutter-flask则是Flask的模板,可以快速生成Flask大型项目模板。

用法

$ pip install cookiecutter
$ cookiecutter https://github.com/xiongxianzhu/cookiecutter-flask.git

你将会被要求填写一些基本的项目信息。

在开发环境运行项目

先将.env文件里的环境变量FLASK_DEBUG设置为1, FLASK_ENV设置为development

$ sudo pip install pipenv
$ pipenv --three
$ pipenv install
$ pipenv shell
(env)$ flask run

就这样! 项目以端口5000运行。

在生产环境运行项目

先将.env文件里的环境变量FLASK_DEBUG设置为0, FLASK_ENV设置为production

$ sudo pip install pipenv
$ pipenv --three
$ pipenv install

用gunicorn作为应用服务器运行

项目提供了一个简单的wsgi入口,例如使用gunicorn或uwsgi运行。

$ pipenv install gunicorn
$ pipenv shell
(env)$ gunicorn {{cookiecutter.app_name}}.wsgi:app

就这样! gunicorn以端口8000运行项目。

用uwsgi作为应用服务器运行

几乎和gunicorn一样:

$ pipenv install uwsgi
$ pipenv shell
(env)$ uwsgi --http 127.0.0.1:5000 --module {{cookiecutter.app_name}}.wsgi:app

就这样! uwsgi以端口5000运行项目。

关于cookiecutter

参考项目

参考文章

About

Cookiecutter可以让你快速从模板中建立工程,cookiecutter-flask则是Flask的模板,可以快速生成Flask大型项目模板。

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages