Skip to content

Instantly share code, notes, and snippets.

flask==2.0.3
flask-jwt-extended==4.4.1
flask-migrate==3.1.0
flask-sqlalchemy==2.5.1
gunicorn==20.1.0
psycopg2-binary==2.9.3
python-dotenv==0.20.0
setuptools==62.1.0
sqlalchemy-utils==0.38.2
# -*- coding: utf-8 -*-
"""This module contains the routes associated with the auth Blueprint."""
from json import JSONDecodeError
from flask import Blueprint, jsonify, request
from flask_jwt_extended import (
create_access_token,
create_refresh_token,
get_jwt_identity,
jwt_required,
# -*- coding: utf-8 -*-
"""This module contains the routes associated with the default Blueprint."""
from json import JSONDecodeError
from flask import Blueprint, jsonify, request
from flask_jwt_extended import get_jwt_identity, jwt_required
from ..auth.helpers import get_admin
from ..extensions import app_logger
from .helpers import handle_create_user, handle_delete_user, handle_get_user, handle_update_user
# -*- coding: utf-8 -*-
"""This module contains the database models used by the auth blueprint."""
from dataclasses import dataclass
from ..constants import EMAIL_MAX_LENGTH, NAME_MAX_LENGTH, PASSWORD_MAX_LENGTH
from ..extensions import db
@dataclass
class Admin(db.Model):
# -*- coding: utf-8 -*-
"""This module contains the database models used by the default blueprint."""
from dataclasses import dataclass
from ..constants import EMAIL_MAX_LENGTH
from ..extensions import db
@dataclass
class User(db.Model):
# -*- coding: utf-8 -*-
"""This module contains initialization code for the api package."""
import os
import sys
from dotenv import load_dotenv
from flask import Flask
from .blueprints.auth.views import auth
from .blueprints.default.views import default
# -*- coding: utf-8 -*-
"""This module contain the confuguration for the application."""
import os
class BaseConfig():
"""Base configuration."""
SECRET_KEY = os.getenv('SECRET_KEY', 'secret_key')
DEBUG = False
@twyle
twyle / .env-f
Last active June 18, 2022 08:31
FLASK_APP=api/__init__.py
FLASK_ENV=development
SECRET_KEY=supersecretkey
POSTGRES_HOST=192.168.xxx.x
POSTGRES_DB=lyle
POSTGRES_PORT=5434
POSTGRES_USER=postgres
POSTGRES_PASSWORD=lyle
# pull official base image
FROM python:3.9.5-slim-buster
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
version: '3'
services:
test-db:
image: postgres
container_name: test_db
restart: always
environment:
POSTGRES_HOST: localhost
POSTGRES_DB: lyle