This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| # uncomment the line below for postgres database url from environment variable | |
| # postgres_local_base = os.environ['DATABASE_URL'] | |
| basedir = os.path.abspath(os.path.dirname(__file__)) | |
| class Config: | |
| SECRET_KEY = os.getenv('SECRET_KEY', 'my_precious_secret_key') | |
| DEBUG = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| from flask_sqlalchemy import SQLAlchemy | |
| from flask_bcrypt import Bcrypt | |
| from .config import config_by_name | |
| db = SQLAlchemy() | |
| flask_bcrypt = Bcrypt() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import unittest | |
| from flask_migrate import Migrate, MigrateCommand | |
| from flask_script import Manager | |
| from app.main import create_app, db | |
| app = create_app(os.getenv('BOILERPLATE_ENV') or 'dev') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from .. import db, flask_bcrypt | |
| class User(db.Model): | |
| """ User Model for storing user related details """ | |
| __tablename__ = "user" | |
| id = db.Column(db.Integer, primary_key=True, autoincrement=True) | |
| email = db.Column(db.String(255), unique=True, nullable=False) | |
| registered_on = db.Column(db.DateTime, nullable=False) | |
| admin = db.Column(db.Boolean, nullable=False, default=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask_testing import TestCase | |
| from app.main import db | |
| from manage import app | |
| class BaseTestCase(TestCase): | |
| """ Base Tests """ | |
| def create_app(self): | |
| app.config.from_object('app.main.config.TestingConfig') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import unittest | |
| from flask import current_app | |
| from flask_testing import TestCase | |
| from manage import app | |
| from app.main.config import basedir | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import uuid | |
| import datetime | |
| from app.main import db | |
| from app.main.model.user import User | |
| def save_new_user(data): | |
| user = User.query.filter_by(email=data['email']).first() | |
| if not user: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask_restplus import Namespace, fields | |
| class UserDto: | |
| api = Namespace('user', description='user related operations') | |
| user = api.model('user', { | |
| 'email': fields.String(required=True, description='user email address'), | |
| 'username': fields.String(required=True, description='user username'), | |
| 'password': fields.String(required=True, description='user password'), | |
| 'public_id': fields.String(description='user Identifier') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import request | |
| from flask_restplus import Resource | |
| from ..util.dto import UserDto | |
| from ..service.user_service import save_new_user, get_all_users, get_a_user | |
| api = UserDto.api | |
| _user = UserDto.user | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # app/__init__.py | |
| from flask_restplus import Api | |
| from flask import Blueprint | |
| from .main.controller.user_controller import api as user_ns | |
| blueprint = Blueprint('api', __name__) | |
| api = Api(blueprint, |
OlderNewer