Merge pull request #314 from dasdachs/pipenv

Added Pipfile and updated {{{cookiecutter.app_name}}/README.rst
master
Steven Loria 7 years ago committed by GitHub
commit 4b8539728b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      cookiecutter.json
  2. 35
      hooks/post_gen_project.py
  3. 57
      {{cookiecutter.app_name}}/Pipfile
  4. 4
      {{cookiecutter.app_name}}/README.rst

@ -4,5 +4,6 @@
"github_username": "sloria", "github_username": "sloria",
"project_name": "My Flask App", "project_name": "My Flask App",
"app_name": "myflaskapp", "app_name": "myflaskapp",
"project_short_description": "A flasky app." "project_short_description": "A flasky app.",
"use_pipenv": ["no", "yes"]
} }

@ -0,0 +1,35 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Post gen hook to ensure that the generated project
hase only one package managment, either pipenv or pip."""
import os
import shutil
import sys
def clean_extra_package_managment_files():
"""Removes either requirements files and folderor the Pipfile."""
use_pipenv = '{{cookiecutter.use_pipenv}}'
to_delete = []
if use_pipenv == 'yes':
to_delete = to_delete + ['requirements.txt', 'requirements']
else:
to_delete.append('Pipfile')
try:
for file_or_dir in to_delete:
if os.path.isfile(file_or_dir):
os.remove(file_or_dir)
else:
shutil.rmtree(file_or_dir)
sys.exit(0)
except OSError as e:
sys.stdout.write(
'While attempting to remove file(s) an error occurred'
)
sys.stdout.write('Error: {}'.format(e))
if __name__ == '__main__':
clean_extra_package_managment_files()

@ -0,0 +1,57 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
# Flask
Flask = "==1.0.2"
MarkupSafe = "==1.0"
Werkzeug = "==0.14.1"
Jinja2 = "==2.10"
itsdangerous = "==0.24"
click = ">=5.0"
# Database
Flask-SQLAlchemy = "==2.3.2"
psycopg2 = "==2.7.5"
SQLAlchemy = "==1.2.8"
# Migrations
Flask-Migrate = "==2.2.0"
# Forms
Flask-WTF = "==0.14.2"
WTForms = "==2.2.1"
# Deployment
gunicorn = ">=19.1.1"
# Webpack
flask-webpack = "==0.1.0"
# Auth
Flask-Login = "==0.4.1"
Flask-Bcrypt = "==0.7.1"
# Caching
Flask-Caching = ">=1.0.0"
# Debug toolbar
Flask-DebugToolbar = "==0.10.1"
[dev-packages]
# Testing
pytest = "==3.6.1"
WebTest = "==2.0.29"
factory-boy = "==2.11.*"
# Lint and code style
flake8 = "==3.5.0"
flake8-blind-except = "==0.1.1"
flake8-debugger = "==3.1.0"
flake8-docstrings = "==1.3.0"
flake8-isort = "==2.5"
flake8-quotes = "==1.0.0"
isort = "==4.3.4"
pep8-naming = "==0.7.0"

@ -19,7 +19,11 @@ Run the following commands to bootstrap your environment ::
git clone https://github.com/{{cookiecutter.github_username}}/{{cookiecutter.app_name}} git clone https://github.com/{{cookiecutter.github_username}}/{{cookiecutter.app_name}}
cd {{cookiecutter.app_name}} cd {{cookiecutter.app_name}}
{%- if cookiecutter.use_pipenv == "yes" %}
pipenv install --dev
{%- else %}
pip install -r requirements/dev.txt pip install -r requirements/dev.txt
{%- endif %}
npm install npm install
npm start # run the webpack dev server and flask server using concurrently npm start # run the webpack dev server and flask server using concurrently

Loading…
Cancel
Save