-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c6c044f
commit 403f3bc
Showing
115 changed files
with
15,013 additions
and
749 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,7 +128,9 @@ dmypy.json | |
*.db | ||
|
||
# vscode settings | ||
*.json | ||
./settings/*.json | ||
|
||
# Sample files | ||
!*.sample.json | ||
|
||
# Flask | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"python.venvPath": "~/.virtualenvs", | ||
"python.pythonPath": "/Users/manrajsingh/.virtualenvs/sat/bin/python", | ||
"python.formatting.provider": "black", | ||
"editor.formatOnSave": true, | ||
"python.linting.enabled": true, | ||
"eslint.autoFixOnSave": true | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"python.venvPath": "~/.envs", | ||
"python.pythonPath": "", | ||
"python.formatting.provider": "black", | ||
"python.linting.enabled": true | ||
"python.venvPath": "~/.envs", | ||
"python.pythonPath": "", | ||
"python.formatting.provider": "black", | ||
"editor.formatOnSave": true, | ||
"python.linting.enabled": true, | ||
"eslint.autoFixOnSave": true | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
__pycache__ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
.Python | ||
env | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
.tox | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
*.log | ||
.git |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
FLASK_APP=app.py | ||
FLASK_DEBUG=0 | ||
FLASK_ENV=production | ||
DATABASE_URL=mysql+pymysql://<username>:<password>@<host>/<database> | ||
SECRET_KEY=randomkeygoeshere | ||
SQLALCHEMY_ECHO=False |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM python:3.7-alpine | ||
|
||
COPY ./requirements.txt /app/backend | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
COPY . /app/backend |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import os | ||
|
||
from flask import Flask, jsonify | ||
from flask_jwt_extended import JWTManager | ||
from flask_migrate import Migrate | ||
from flask_sqlalchemy import SQLAlchemy | ||
from flask_redis import FlaskRedis | ||
from werkzeug.exceptions import HTTPException, default_exceptions | ||
|
||
from backend.config import Config | ||
|
||
|
||
def create_app(test_config=None): | ||
app = Flask(__name__, instance_relative_config=True) | ||
|
||
app.config.from_object(Config) | ||
|
||
return app | ||
|
||
|
||
app = create_app() | ||
|
||
db = SQLAlchemy(app) | ||
migrate = Migrate(app, db) | ||
jwt = JWTManager(app) | ||
redis_client = FlaskRedis(app) | ||
# login = LoginManager(app) | ||
# login.login_view = "routes.login" | ||
|
||
from backend import models | ||
|
||
|
||
def handle_error(error): | ||
if isinstance(error, HTTPException): | ||
return jsonify(message=error.description, code=error.code) | ||
return jsonify(message="An error occured", code=500) | ||
|
||
|
||
for exc in default_exceptions: | ||
app.register_error_handler(exc, handle_error) | ||
|
||
|
||
# @login.user_loader | ||
# def load_user(id): | ||
# return models.User.query.get(int(id)) | ||
|
||
|
||
from .routes import auth, api | ||
|
||
app.register_blueprint(auth) | ||
app.register_blueprint(api) | ||
# app.add_template_global(name='version', f='1.0') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from backend import app, db | ||
|
||
|
||
@app.shell_context_processor | ||
def make_shell_context(): | ||
return {"db": db, "app": app} | ||
|
||
|
||
@app.teardown_request | ||
def teardown_request(exception): | ||
if exception: | ||
db.session.rollback() | ||
db.session.remove() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
|
||
from datetime import timedelta | ||
|
||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
|
||
class Config(object): | ||
SECRET_KEY = os.environ.get("SECRET_KEY", None) | ||
SQLALCHEMY_DATABASE_URI = os.environ.get( | ||
"DATABASE_URL" | ||
) or "sqlite:///" + os.path.join(basedir, "app.db") | ||
SQLALCHEMY_TRACK_MODIFICATIONS = False | ||
SQLALCHEMY_ECHO = True if os.environ.get("SQLALCHEMY_ECHO") == "True" else False | ||
REDIS_URL = os.environ.get("JWT_REDIS_STORE_URL", "") | ||
JWT_SECRET_KEY = os.environ.get("JWT_SECRET_KEY", "") | ||
JWT_ACCESS_TOKEN_EXPIRES = os.environ.get( | ||
"JWT_ACCESS_TOKEN_EXPIRES", timedelta(days=7) | ||
) | ||
JWT_BLACKLIST_ENABLED = True | ||
JWT_HEADER_TYPE = None | ||
JWT_BLACKLIST_TOKEN_CHECKS = ["access"] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.