parent
3344480ffb
commit
abda53a2f3
@ -1 +1 @@ |
||||
web: gunicorn {{cookiecutter.repo_name}}.main:app -b 0.0.0.0:$PORT -w 3 |
||||
web: gunicorn {{cookiecutter.repo_name}}.app:create_app\(\) -b 0.0.0.0:$PORT -w 3 |
||||
|
@ -0,0 +1,8 @@ |
||||
# -*- coding: utf-8 -*- |
||||
'''Database module, including the SQLAlchemy database object and DB-related |
||||
mixins. |
||||
''' |
||||
|
||||
from flask.ext.sqlalchemy import SQLAlchemy |
||||
|
||||
db = SQLAlchemy() |
@ -1,15 +0,0 @@ |
||||
#!/usr/bin/env python |
||||
# -*- coding: utf-8 -*- |
||||
""" |
||||
Entry point for all things, to avoid circular imports. |
||||
""" |
||||
import os |
||||
from .app import create_app |
||||
from .models import User, db |
||||
import {{cookiecutter.repo_name}}.modules as modules |
||||
|
||||
if __name__ == '__main__': |
||||
# Get the environment setting from the system environment variable |
||||
env = os.environ.get("{{cookiecutter.repo_name | upper}}_ENV", "prod") |
||||
app = create_app("{{cookiecutter.repo_name}}.settings.{env}Config" |
||||
.format(env=env.capitalize())) |
@ -1 +0,0 @@ |
||||
'''Blueprint modules for {{cookiecutter.repo_name}}.''' |
@ -1,14 +0,0 @@ |
||||
# -*- coding: utf-8 -*- |
||||
'''Members-only module, typically including the app itself. |
||||
''' |
||||
from flask import Blueprint, render_template |
||||
from {{cookiecutter.repo_name}}.utils import login_required |
||||
|
||||
blueprint = Blueprint('member', __name__, |
||||
static_folder="../static", |
||||
template_folder="../templates") |
||||
|
||||
@blueprint.route("/members/") |
||||
@login_required |
||||
def members(): |
||||
return render_template("members.html") |
@ -0,0 +1,4 @@ |
||||
# -*- coding: utf-8 -*- |
||||
'''The public module, including the homepage and user auth.''' |
||||
|
||||
import views |
@ -1,17 +1,19 @@ |
||||
# -*- coding: utf-8 -*- |
||||
from flask_wtf import Form |
||||
from wtforms import TextField, PasswordField |
||||
from wtforms.validators import DataRequired, Email, EqualTo, Length |
||||
|
||||
|
||||
class RegisterForm(Form): |
||||
username = TextField('Username', validators=[DataRequired(), Length(min=3, max=25)]) |
||||
email = TextField('Email', validators=[DataRequired(), Email(), Length(min=6, max=40)]) |
||||
username = TextField('Username', |
||||
validators=[DataRequired(), Length(min=3, max=25)]) |
||||
email = TextField('Email', |
||||
validators=[DataRequired(), Email(), Length(min=6, max=40)]) |
||||
password = PasswordField('Password', |
||||
validators=[DataRequired(), Length(min=6, max=40)]) |
||||
confirm = PasswordField( |
||||
'Verify password', |
||||
confirm = PasswordField('Verify password', |
||||
[DataRequired(), EqualTo('password', message='Passwords must match')]) |
||||
|
||||
|
||||
class LoginForm(Form): |
||||
username = TextField('Username', validators=[DataRequired()]) |
||||
password = PasswordField('Password', validators=[DataRequired()]) |
@ -0,0 +1,3 @@ |
||||
'''The user module.''' |
||||
|
||||
import views |
@ -0,0 +1,12 @@ |
||||
from flask import Blueprint, render_template |
||||
|
||||
from {{cookiecutter.repo_name}}.utils import login_required |
||||
|
||||
|
||||
blueprint = Blueprint("user", __name__, url_prefix='/users') |
||||
|
||||
|
||||
@blueprint.route("/") |
||||
@login_required |
||||
def members(): |
||||
return render_template("users/members.html") |
Loading…
Reference in new issue