Skip to content

Updates, switch to pipenv #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ node_modules/*
*app.db*
bundle.js
bundle.min.js
yarn.lock
yarn.lock
TODO
37 changes: 37 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[dev-packages]

[packages]
alembic = "*"
certifi = "*"
chardet = "*"
click = "*"
Flask = "*"
Flask-Login = "*"
Flask-Migrate = "*"
Flask-Script = "*"
Flask-SQLAlchemy = "*"
Flask-WTF = "*"
gunicorn = "*"
idna = "*"
itsdangerous = "*"
Jinja2 = "*"
Mako = "*"
MarkupSafe = "*"
python-dateutil = "*"
python-editor = "*"
requests = "*"
six = "*"
SQLAlchemy = "*"
urllib3 = "*"
Werkzeug = "*"
WTForms = "*"
mysqlclient = "*"
psycopg2 = "*"

[requires]
python_version = "2.7"
248 changes: 248 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ This is a strong Flask base/boilerplate focusing on simplicity, while still havi
- [Mail](#setting-up-mail)
- [Deploying](#deploying)


### Features

- Always updated, production ready, modern tooling
Expand All @@ -26,15 +25,14 @@ This is a strong Flask base/boilerplate focusing on simplicity, while still havi
#### Libraries

- **Flask:** Flask-SQLAlchemy, Flask-WTF, Flask-Login, Alembic/Flask-Migrate
- **JS & Frontend:** Bootstrap 4, Gulp, Livereload, and Webpack
- **JS & Frontend:** Bootstrap 4 (beta 2), Gulp, Livereload, and Webpack

### Quick Setup

```shell
# Python
virtualenv venv
source venv/bin/activate
pip install -r requirements/base.txt
pipenv install
pipenv shell

# Database
python manage.py db init
Expand All @@ -57,7 +55,7 @@ npm run buildprod # minified, prod-ready
source venv/bin/activate
python run.py

# Livereload and SASS
# Livereload and SASS compilation
gulp

# To recompile bundle.js (if you change app.js), run one the following:
Expand All @@ -78,20 +76,12 @@ This boilerplate is ready for MySQL and Postgres, but uses sqlite by default. If

1. Create your database
2. In `app/config.py` you should comment the sqlite config line (11) and uncomment either mysql (19-20) or postgres (23-24). Make sure that you change the database name and add passwords or anything else you need to the connect string!
3. Execute either `pip install -r requirements.txt/mysql.txt` or `pip install -r requirements.txt/postgres.txt` (while inside virtual environment) to install the libraries needed for each respective database.
3. Execute either `pip install -r requirements/mysql.txt` or `pip install -r requirements/postgres.txt` (while inside virtual environment) to install the libraries needed for each respective database.

### Setting up mail
*Optional*

A lot of applications tend to use Flask-Mail and suggest to create a gmail address to send email with. While this works fine for small things, it isn't production-ready and Gmail doesn't exist to send transactional email (forgot password, confirm email, etc.). For this reason, my mail setup uses Sparkpost which has 100,000 emails per month for free. I am not sponsored or compensated in any way by Sparkpost. I have never exceeded this monthly limit, and the platform is rich and simple to use. It has reporting and other features that are great for real world applications.

1. Create an account on sparkpost.com
2. In your local environment, set the `SPARKPOST_API_KEY`:
`export SPARKPOST_API_KEY='yourkeyhere'`
3. Update mail config variables in config.py
4. All set!

If you use another transactional platform like Mandrill, it should be very simple to drop in here. Feel free to submit a PR with a new branch for any alternative email setups.
Removed for now.

### Deploying

Expand Down
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# App
app = Flask(__name__)
config = app.config.from_object('app.config')
config = app.config.from_object('app.settings')

# Database
db = SQLAlchemy(app)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from flask import render_template, flash, redirect, session, url_for, request, g, abort, send_from_directory
from flask_login import login_user, logout_user, current_user, login_required
from .models import *
from .config import *
from .settings import *
from .forms import *
import requests, json, time, datetime

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"gulp-sass": "^2.3.2"
},
"dependencies": {
"bootstrap": "^4.0.0-beta.2",
"bootstrap": "^4.0.0",
"jquery": "^3.1.1",
"popper.js": "^1.12.6",
"tether": "^1.3.7",
Expand Down
Loading