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 .models.core import db | |
| from .models.user import user_datastore | |
| from . import views | |
| from flask_security import Security | |
| def register_blueprints_on_app(app): | |
| app.register_blueprint(views.main_pages_bp) | |
| app.register_blueprint(views.main_api_bp, url_prefix='/api') |
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 .core import db | |
| from flask_security import ( | |
| SQLAlchemyUserDatastore, UserMixin, RoleMixin) | |
| from sqlalchemy import func | |
| class UserRole(db.Model): | |
| id = db.Column(db.Integer, primary_key=True, unique=True) | |
| created_on = db.Column(db.DateTime(), default=func.now()) | |
| user_id = db.Column(db.Integer, db.ForeignKey('user.id')) |
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 "macros.html" as macros %} | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <title>Flask Boilerplate Demo</title> | |
| <!-- Tell the browser to be responsive to screen width --> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| {% include "layout_sections/layout_assets_at_top.html" %} |
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 app.app_factory import create_app | |
| import app.models as models | |
| import IPython | |
| def run_interactive_shell(): | |
| app = create_app() | |
| # Needed for making the console work in app request context | |
| ctx = app.test_request_context() |
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_script import Manager | |
| from flask_migrate import Migrate, MigrateCommand | |
| from app.models import db | |
| from app.app_factory import create_app | |
| def create_db_manager(): | |
| app = create_app(register_blueprints=False) | |
| migrate = Migrate(app, db) | |
| manager = Manager(app) |
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
| {% extends "layout.html" %} | |
| {% block page_content %} | |
| <div class="starter-template"> | |
| <h1>Home Page Title</h1> | |
| {% if current_user.is_authenticated %} | |
| <p>Logged in as {{current_user}}</p> | |
| {% else %} |
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
| {% macro static_js_tag(filepath) %} | |
| <script | |
| type="text/javascript" | |
| src="{{url_for('static', filename=filepath)}}"> | |
| </script> | |
| {% endmacro %} | |
| {% macro static_css_tag(filepath) %} | |
| <link | |
| rel="stylesheet" |
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 werkzeug.serving import run_simple | |
| from app import app_factory | |
| application = app_factory.create_app() | |
| if __name__ == "__main__": | |
| run_simple( | |
| '0.0.0.0', 5000, | |
| application, |
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 | |
| │ ├── app_factory.py | |
| │ ├── default_config.py | |
| │ ├── __init__.py | |
| │ ├── models | |
| │ │ ├── core.py | |
| │ │ ├── __init__.py | |
| │ │ └── user.py | |
| │ ├── static | |
| │ │ ├── css |
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 git import Repo | |
| import io | |
| import ast | |
| import difflib | |
| from toolspy.collection_tools import intersection | |
| def file_handle_from_git_ref(repo_path, relative_file_path, branch_name="master"): | |
| repo = Repo.init(repo_path) | |
| tree = repo.heads[branch_name].commit.tree |