├── .dockerignore ├── .env ├── .gitignore ├── CHANGELOG.md ├── Dockerfile ├── LICENSE.md ├── README.md ├── apps ├── __init__.py ├── authentication │ ├── __init__.py │ ├── forms.py │ ├── models.py │ ├── routes.py │ └── util.py ├── config.py ├── home │ ├── __init__.py │ └── routes.py ├── static │ └── assets │ │ ├── .gitkeep │ │ ├── css │ │ ├── bootstrap.min.css │ │ ├── now-ui-dashboard.css │ │ ├── now-ui-dashboard.css.map │ │ └── now-ui-dashboard.min.css │ │ ├── demo │ │ ├── demo.css │ │ └── demo.js │ │ ├── fonts │ │ ├── nucleo-license.md │ │ ├── nucleo-outline.eot │ │ ├── nucleo-outline.ttf │ │ ├── nucleo-outline.woff │ │ └── nucleo-outline.woff2 │ │ ├── gulpfile.js │ │ ├── img │ │ ├── apple-icon.png │ │ ├── bg5.jpg │ │ ├── default-avatar.png │ │ ├── favicon.png │ │ ├── header.jpg │ │ ├── mike.jpg │ │ ├── now-logo.png │ │ └── now-ui-dashboard.gif │ │ ├── js │ │ ├── core │ │ │ ├── bootstrap.min.js │ │ │ ├── jquery.min.js │ │ │ └── popper.min.js │ │ ├── now-ui-dashboard.js │ │ ├── now-ui-dashboard.min.js │ │ └── plugins │ │ │ ├── bootstrap-notify.js │ │ │ ├── chartjs.min.js │ │ │ └── perfect-scrollbar.jquery.min.js │ │ ├── package.json │ │ └── scss │ │ ├── now-ui-dashboard.scss │ │ └── now-ui-dashboard │ │ ├── _alerts.scss │ │ ├── _buttons.scss │ │ ├── _cards.scss │ │ ├── _checkboxes-radio.scss │ │ ├── _dropdown.scss │ │ ├── _fixed-plugin.scss │ │ ├── _footers.scss │ │ ├── _images.scss │ │ ├── _inputs.scss │ │ ├── _misc.scss │ │ ├── _mixins.scss │ │ ├── _navbar.scss │ │ ├── _nucleo-outline.scss │ │ ├── _page-header.scss │ │ ├── _responsive.scss │ │ ├── _sidebar-and-main-panel.scss │ │ ├── _tables.scss │ │ ├── _typography.scss │ │ ├── _variables.scss │ │ ├── cards │ │ ├── _card-chart.scss │ │ ├── _card-map.scss │ │ ├── _card-plain.scss │ │ └── _card-user.scss │ │ ├── mixins │ │ ├── _buttons.scss │ │ ├── _cards.scss │ │ ├── _dropdown.scss │ │ ├── _inputs.scss │ │ ├── _page-header.scss │ │ ├── _sidebar.scss │ │ ├── _transparency.scss │ │ └── _vendor-prefixes.scss │ │ └── plugins │ │ ├── _plugin-animate-bootstrap-notify.scss │ │ └── _plugin-perfect-scrollbar.scss └── templates │ ├── .gitkeep │ ├── accounts │ ├── login.html │ └── register.html │ ├── home │ ├── icons.html │ ├── index.html │ ├── login.html │ ├── map.html │ ├── notifications.html │ ├── page-403.html │ ├── page-404.html │ ├── page-500.html │ ├── page-blank.html │ ├── register.html │ ├── tables.html │ ├── typography.html │ └── user.html │ ├── includes │ ├── footer.html │ ├── navigation.html │ ├── scripts.html │ └── sidebar.html │ └── layouts │ ├── base-fullscreen.html │ └── base.html ├── docker-compose.yml ├── env.sample ├── gunicorn-cfg.py ├── media ├── flask-now-ui-dashboard-intro.gif ├── flask-now-ui-dashboard-screen-alerts.png ├── flask-now-ui-dashboard-screen-icons.png ├── flask-now-ui-dashboard-screen-login.png ├── flask-now-ui-dashboard-screen-maps.png ├── flask-now-ui-dashboard-screen-register.png └── flask-now-ui-dashboard-screen.png ├── nginx └── appseed-app.conf ├── package.json ├── requirements.txt └── run.py /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | __pycache__ 3 | *.pyc 4 | *.pyo 5 | *.pyd -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # True for development, False for production 2 | DEBUG=True 3 | 4 | # Flask ENV 5 | FLASK_APP=run.py 6 | FLASK_ENV=development 7 | 8 | # Used for CDN (in production) 9 | # No Slash at the end 10 | ASSETS_ROOT=/static/assets 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # tests and coverage 6 | *.pytest_cache 7 | .coverage 8 | 9 | # database & logs 10 | *.db 11 | *.sqlite3 12 | *.log 13 | 14 | # venv 15 | env 16 | venv 17 | 18 | # other 19 | .DS_Store 20 | 21 | # sphinx docs 22 | _build 23 | _static 24 | _templates 25 | 26 | # javascript 27 | package-lock.json 28 | .vscode/symbols.json 29 | 30 | apps/static/assets/node_modules 31 | apps/static/assets/yarn.lock 32 | apps/static/assets/.temp 33 | 34 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [1.0.3] 2022-10-13 4 | ### Improvements 5 | 6 | - Bump codebase version 7 | - Minor UI/UX improvements 8 | 9 | ## [1.0.2] 2021-11-29 10 | ### Improvements 11 | 12 | - Bump Codebase: [Flask Dashboard](https://github.com/app-generator/boilerplate-code-flask-dashboard) v2.0.0 13 | - Dependencies update (all packages) 14 | - Flask==2.0.1 (latest stable version) 15 | - Better Code formatting 16 | - Improved Files organization 17 | - Optimize imports 18 | - Docker Scripts Update 19 | - Gulp Tooling (SASS Compilation) 20 | 21 | ## [1.0.1] 2021-02-04 22 | ### Improvements 23 | 24 | - Bump UI: [Jinja Now UI Dashboard](https://github.com/app-generator/jinja-now-ui-dashboard/releases) v1.0.1 25 | - Bump Codebase: [Flask Dashboard](https://github.com/app-generator/boilerplate-code-flask-dashboard) v1.0.4 26 | 27 | ## [1.0.0] 2020-02-07 28 | ### Initial Release 29 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.9 2 | 3 | # set environment variables 4 | ENV PYTHONDONTWRITEBYTECODE 1 5 | ENV PYTHONUNBUFFERED 1 6 | 7 | COPY requirements.txt . 8 | 9 | # install python dependencies 10 | RUN pip install --upgrade pip 11 | RUN pip install --no-cache-dir -r requirements.txt 12 | 13 | COPY . . 14 | 15 | # gunicorn 16 | CMD ["gunicorn", "--config", "gunicorn-cfg.py", "run:app"] 17 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2019 - present [AppSeed](http://appseed.us/) 4 | 5 |
6 | 7 | ## Licensing Information 8 | 9 |
10 | 11 | | Item | - | 12 | | ---------------------------------- | --- | 13 | | License Type | MIT | 14 | | Use for print | **YES** | 15 | | Create single personal website/app | **YES** | 16 | | Create single website/app for client | **YES** | 17 | | Create multiple website/apps for clients | **YES** | 18 | | Create multiple SaaS applications | **YES** | 19 | | End-product paying users | **YES** | 20 | | Product sale | **YES** | 21 | | Remove footer credits | **YES** | 22 | | --- | --- | 23 | | Remove copyright mentions from source code | NO | 24 | | Production deployment assistance | NO | 25 | | Create HTML/CSS template for sale | NO | 26 | | Create Theme/Template for CMS for sale | NO | 27 | | Separate sale of our UI Elements | NO | 28 | 29 |
30 | 31 | --- 32 | For more information regarding licensing, please contact the AppSeed Service < *support@appseed.us* > 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Flask Now UI Dashboard](https://appseed.us/product/now-ui-dashboard/flask/) 2 | 3 | Open-source **[Flask Dashboard](https://appseed.us/admin-dashboards/flask/)** generated by `AppSeed` on top of a modern design. **Now UI Dashboard** is a responsive Bootstrap 4 kit provided for free by Invision and Creative Tim. Now UI Dashboard comes packed with all the plugins that you might need inside a project and documentation on how to get started. It is light and easy to use, and also very powerful. 4 | 5 | - 👉 [Flask Now UI Dashboard](https://appseed.us/product/now-ui-dashboard/flask/) - Product page 6 | - 👉 [Flask Now UI Dashboard](https://flask-now-ui-dashboard.appseed-srv1.com) - LIVE App deployment 7 | 8 |
9 | 10 | > 🚀 Built with [App Generator](https://appseed.us/generator/), Timestamp: `2022-06-09 11:53` 11 | 12 | - ✅ `Up-to-date dependencies` 13 | - ✅ Database: `sqlite` 14 | - ✅ `DB Tools`: SQLAlchemy ORM, Flask-Migrate (schema migrations) 15 | - ✅ Session-Based authentication (via **flask_login**), Forms validation 16 | - ✅ `Docker` 17 | 18 |
19 | 20 | ![Flask Now UI Dashboard - Starter generated by AppSeed.](https://user-images.githubusercontent.com/51070104/195570461-0b04f188-72c3-453f-8d1b-46386476fe09.png) 21 | 22 |
23 | 24 | ## ✨ Start the app in `Docker` 25 | 26 | > 👉 **Step 1** - Download the code from the GH repository (using `GIT`) 27 | 28 | ```bash 29 | $ git clone https://github.com/app-generator/flask-now-ui-dashboard.git 30 | $ cd flask-now-ui-dashboard 31 | ``` 32 | 33 |
34 | 35 | > 👉 **Step 2** - Start the APP in `Docker` 36 | 37 | ```bash 38 | $ docker-compose up --build 39 | ``` 40 | 41 | Visit `http://localhost:5085` in your browser. The app should be up & running. 42 | 43 |
44 | 45 | ## ✨ How to use it 46 | 47 | > Download the code 48 | 49 | ```bash 50 | $ git clone https://github.com/app-generator/flask-now-ui-dashboard.git 51 | $ cd flask-now-ui-dashboard 52 | ``` 53 | 54 |
55 | 56 | ### 👉 Set Up for `Unix`, `MacOS` 57 | 58 | > Install modules via `VENV` 59 | 60 | ```bash 61 | $ virtualenv env 62 | $ source env/bin/activate 63 | $ pip3 install -r requirements.txt 64 | ``` 65 | 66 |
67 | 68 | > Set Up Flask Environment 69 | 70 | ```bash 71 | $ export FLASK_APP=run.py 72 | $ export FLASK_ENV=development 73 | ``` 74 | 75 |
76 | 77 | > Start the app 78 | 79 | ```bash 80 | $ flask run 81 | ``` 82 | 83 | At this point, the app runs at `http://127.0.0.1:5000/`. 84 | 85 |
86 | 87 | ### 👉 Set Up for `Windows` 88 | 89 | > Install modules via `VENV` (windows) 90 | 91 | ``` 92 | $ virtualenv env 93 | $ .\env\Scripts\activate 94 | $ pip3 install -r requirements.txt 95 | ``` 96 | 97 |
98 | 99 | > Set Up Flask Environment 100 | 101 | ```bash 102 | $ # CMD 103 | $ set FLASK_APP=run.py 104 | $ set FLASK_ENV=development 105 | $ 106 | $ # Powershell 107 | $ $env:FLASK_APP = ".\run.py" 108 | $ $env:FLASK_ENV = "development" 109 | ``` 110 | 111 |
112 | 113 | > Start the app 114 | 115 | ```bash 116 | $ flask run 117 | ``` 118 | 119 | At this point, the app runs at `http://127.0.0.1:5000/`. 120 | 121 |
122 | 123 | ### 👉 Create Users 124 | 125 | By default, the app redirects guest users to authenticate. In order to access the private pages, follow this set up: 126 | 127 | - Start the app via `flask run` 128 | - Access the `registration` page and create a new user: 129 | - `http://127.0.0.1:5000/register` 130 | - Access the `sign in` page and authenticate 131 | - `http://127.0.0.1:5000/login` 132 | 133 |
134 | 135 | ## ✨ Code-base structure 136 | 137 | The project is coded using blueprints, app factory pattern, dual configuration profile (development and production) and an intuitive structure presented bellow: 138 | 139 | ```bash 140 | < PROJECT ROOT > 141 | | 142 | |-- apps/ 143 | | | 144 | | |-- home/ # A simple app that serve HTML files 145 | | | |-- routes.py # Define app routes 146 | | | 147 | | |-- authentication/ # Handles auth routes (login and register) 148 | | | |-- routes.py # Define authentication routes 149 | | | |-- models.py # Defines models 150 | | | |-- forms.py # Define auth forms (login and register) 151 | | | 152 | | |-- static/ 153 | | | |-- # CSS files, Javascripts files 154 | | | 155 | | |-- templates/ # Templates used to render pages 156 | | | |-- includes/ # HTML chunks and components 157 | | | | |-- navigation.html # Top menu component 158 | | | | |-- sidebar.html # Sidebar component 159 | | | | |-- footer.html # App Footer 160 | | | | |-- scripts.html # Scripts common to all pages 161 | | | | 162 | | | |-- layouts/ # Master pages 163 | | | | |-- base-fullscreen.html # Used by Authentication pages 164 | | | | |-- base.html # Used by common pages 165 | | | | 166 | | | |-- accounts/ # Authentication pages 167 | | | | |-- login.html # Login page 168 | | | | |-- register.html # Register page 169 | | | | 170 | | | |-- home/ # UI Kit Pages 171 | | | |-- index.html # Index page 172 | | | |-- 404-page.html # 404 page 173 | | | |-- *.html # All other pages 174 | | | 175 | | config.py # Set up the app 176 | | __init__.py # Initialize the app 177 | | 178 | |-- requirements.txt # App Dependencies 179 | | 180 | |-- .env # Inject Configuration via Environment 181 | |-- run.py # Start the app - WSGI gateway 182 | | 183 | |-- ************************************************************************ 184 | ``` 185 | 186 |
187 | 188 | --- 189 | [Flask Now UI Dashboard](https://appseed.us/product/now-ui-dashboard/flask/) - Open-source starter generated by **[App Generator](https://appseed.us/generator/)**. 190 | -------------------------------------------------------------------------------- /apps/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | """ 3 | Copyright (c) 2019 - present AppSeed.us 4 | """ 5 | 6 | from flask import Flask 7 | from flask_login import LoginManager 8 | from flask_sqlalchemy import SQLAlchemy 9 | from importlib import import_module 10 | 11 | 12 | db = SQLAlchemy() 13 | login_manager = LoginManager() 14 | 15 | 16 | def register_extensions(app): 17 | db.init_app(app) 18 | login_manager.init_app(app) 19 | 20 | 21 | def register_blueprints(app): 22 | for module_name in ('authentication', 'home'): 23 | module = import_module('apps.{}.routes'.format(module_name)) 24 | app.register_blueprint(module.blueprint) 25 | 26 | 27 | def configure_database(app): 28 | 29 | @app.before_first_request 30 | def initialize_database(): 31 | db.create_all() 32 | 33 | @app.teardown_request 34 | def shutdown_session(exception=None): 35 | db.session.remove() 36 | 37 | 38 | def create_app(config): 39 | app = Flask(__name__) 40 | app.config.from_object(config) 41 | register_extensions(app) 42 | register_blueprints(app) 43 | configure_database(app) 44 | return app 45 | -------------------------------------------------------------------------------- /apps/authentication/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | """ 3 | Copyright (c) 2019 - present AppSeed.us 4 | """ 5 | 6 | from flask import Blueprint 7 | 8 | blueprint = Blueprint( 9 | 'authentication_blueprint', 10 | __name__, 11 | url_prefix='' 12 | ) 13 | -------------------------------------------------------------------------------- /apps/authentication/forms.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | """ 3 | Copyright (c) 2019 - present AppSeed.us 4 | """ 5 | 6 | from flask_wtf import FlaskForm 7 | from wtforms import StringField, PasswordField 8 | from wtforms.validators import Email, DataRequired 9 | 10 | # login and registration 11 | 12 | 13 | class LoginForm(FlaskForm): 14 | username = StringField('Username', 15 | id='username_login', 16 | validators=[DataRequired()]) 17 | password = PasswordField('Password', 18 | id='pwd_login', 19 | validators=[DataRequired()]) 20 | 21 | 22 | class CreateAccountForm(FlaskForm): 23 | username = StringField('Username', 24 | id='username_create', 25 | validators=[DataRequired()]) 26 | email = StringField('Email', 27 | id='email_create', 28 | validators=[DataRequired(), Email()]) 29 | password = PasswordField('Password', 30 | id='pwd_create', 31 | validators=[DataRequired()]) 32 | -------------------------------------------------------------------------------- /apps/authentication/models.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | """ 3 | Copyright (c) 2019 - present AppSeed.us 4 | """ 5 | 6 | from flask_login import UserMixin 7 | 8 | from apps import db, login_manager 9 | 10 | from apps.authentication.util import hash_pass 11 | 12 | class Users(db.Model, UserMixin): 13 | 14 | __tablename__ = 'Users' 15 | 16 | id = db.Column(db.Integer, primary_key=True) 17 | username = db.Column(db.String(64), unique=True) 18 | email = db.Column(db.String(64), unique=True) 19 | password = db.Column(db.LargeBinary) 20 | 21 | def __init__(self, **kwargs): 22 | for property, value in kwargs.items(): 23 | # depending on whether value is an iterable or not, we must 24 | # unpack it's value (when **kwargs is request.form, some values 25 | # will be a 1-element list) 26 | if hasattr(value, '__iter__') and not isinstance(value, str): 27 | # the ,= unpack of a singleton fails PEP8 (travis flake8 test) 28 | value = value[0] 29 | 30 | if property == 'password': 31 | value = hash_pass(value) # we need bytes here (not plain str) 32 | 33 | setattr(self, property, value) 34 | 35 | def __repr__(self): 36 | return str(self.username) 37 | 38 | 39 | @login_manager.user_loader 40 | def user_loader(id): 41 | return Users.query.filter_by(id=id).first() 42 | 43 | 44 | @login_manager.request_loader 45 | def request_loader(request): 46 | username = request.form.get('username') 47 | user = Users.query.filter_by(username=username).first() 48 | return user if user else None 49 | -------------------------------------------------------------------------------- /apps/authentication/routes.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | """ 3 | Copyright (c) 2019 - present AppSeed.us 4 | """ 5 | 6 | from flask import render_template, redirect, request, url_for 7 | from flask_login import ( 8 | current_user, 9 | login_user, 10 | logout_user 11 | ) 12 | 13 | from apps import db, login_manager 14 | from apps.authentication import blueprint 15 | from apps.authentication.forms import LoginForm, CreateAccountForm 16 | from apps.authentication.models import Users 17 | 18 | from apps.authentication.util import verify_pass 19 | 20 | @blueprint.route('/') 21 | def route_default(): 22 | return redirect(url_for('authentication_blueprint.login')) 23 | 24 | # Login & Registration 25 | 26 | @blueprint.route('/login', methods=['GET', 'POST']) 27 | def login(): 28 | login_form = LoginForm(request.form) 29 | if 'login' in request.form: 30 | 31 | # read form data 32 | username = request.form['username'] 33 | password = request.form['password'] 34 | 35 | # Locate user 36 | user = Users.query.filter_by(username=username).first() 37 | 38 | # Check the password 39 | if user and verify_pass(password, user.password): 40 | 41 | login_user(user) 42 | return redirect(url_for('authentication_blueprint.route_default')) 43 | 44 | # Something (user or pass) is not ok 45 | return render_template('accounts/login.html', 46 | msg='Wrong user or password', 47 | form=login_form) 48 | 49 | if not current_user.is_authenticated: 50 | return render_template('accounts/login.html', 51 | form=login_form) 52 | return redirect(url_for('home_blueprint.index')) 53 | 54 | 55 | @blueprint.route('/register', methods=['GET', 'POST']) 56 | def register(): 57 | create_account_form = CreateAccountForm(request.form) 58 | if 'register' in request.form: 59 | 60 | username = request.form['username'] 61 | email = request.form['email'] 62 | 63 | # Check usename exists 64 | user = Users.query.filter_by(username=username).first() 65 | if user: 66 | return render_template('accounts/register.html', 67 | msg='Username already registered', 68 | success=False, 69 | form=create_account_form) 70 | 71 | # Check email exists 72 | user = Users.query.filter_by(email=email).first() 73 | if user: 74 | return render_template('accounts/register.html', 75 | msg='Email already registered', 76 | success=False, 77 | form=create_account_form) 78 | 79 | # else we can create the user 80 | user = Users(**request.form) 81 | db.session.add(user) 82 | db.session.commit() 83 | 84 | # Delete user from session 85 | logout_user() 86 | 87 | return render_template('accounts/register.html', 88 | msg='User created successfully.', 89 | success=True, 90 | form=create_account_form) 91 | 92 | else: 93 | return render_template('accounts/register.html', form=create_account_form) 94 | 95 | 96 | @blueprint.route('/logout') 97 | def logout(): 98 | logout_user() 99 | return redirect(url_for('authentication_blueprint.login')) 100 | 101 | # Errors 102 | 103 | @login_manager.unauthorized_handler 104 | def unauthorized_handler(): 105 | return render_template('home/page-403.html'), 403 106 | 107 | 108 | @blueprint.errorhandler(403) 109 | def access_forbidden(error): 110 | return render_template('home/page-403.html'), 403 111 | 112 | 113 | @blueprint.errorhandler(404) 114 | def not_found_error(error): 115 | return render_template('home/page-404.html'), 404 116 | 117 | 118 | @blueprint.errorhandler(500) 119 | def internal_error(error): 120 | return render_template('home/page-500.html'), 500 121 | -------------------------------------------------------------------------------- /apps/authentication/util.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | """ 3 | Copyright (c) 2019 - present AppSeed.us 4 | """ 5 | 6 | import os 7 | import hashlib 8 | import binascii 9 | 10 | # Inspiration -> https://www.vitoshacademy.com/hashing-passwords-in-python/ 11 | 12 | 13 | def hash_pass(password): 14 | """Hash a password for storing.""" 15 | 16 | salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii') 17 | pwdhash = hashlib.pbkdf2_hmac('sha512', password.encode('utf-8'), 18 | salt, 100000) 19 | pwdhash = binascii.hexlify(pwdhash) 20 | return (salt + pwdhash) # return bytes 21 | 22 | 23 | def verify_pass(provided_password, stored_password): 24 | """Verify a stored password against one provided by user""" 25 | 26 | stored_password = stored_password.decode('ascii') 27 | salt = stored_password[:64] 28 | stored_password = stored_password[64:] 29 | pwdhash = hashlib.pbkdf2_hmac('sha512', 30 | provided_password.encode('utf-8'), 31 | salt.encode('ascii'), 32 | 100000) 33 | pwdhash = binascii.hexlify(pwdhash).decode('ascii') 34 | return pwdhash == stored_password 35 | -------------------------------------------------------------------------------- /apps/config.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | """ 3 | Copyright (c) 2019 - present AppSeed.us 4 | """ 5 | 6 | import os 7 | 8 | class Config(object): 9 | 10 | basedir = os.path.abspath(os.path.dirname(__file__)) 11 | 12 | # Set up the App SECRET_KEY 13 | # SECRET_KEY = config('SECRET_KEY' , default='S#perS3crEt_007') 14 | SECRET_KEY = os.getenv('SECRET_KEY', 'S#perS3crEt_007') 15 | 16 | # This will create a file in FOLDER 17 | SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'db.sqlite3') 18 | SQLALCHEMY_TRACK_MODIFICATIONS = False 19 | 20 | # Assets Management 21 | ASSETS_ROOT = os.getenv('ASSETS_ROOT', '/static/assets') 22 | 23 | class ProductionConfig(Config): 24 | DEBUG = False 25 | 26 | # Security 27 | SESSION_COOKIE_HTTPONLY = True 28 | REMEMBER_COOKIE_HTTPONLY = True 29 | REMEMBER_COOKIE_DURATION = 3600 30 | 31 | # PostgreSQL database 32 | SQLALCHEMY_DATABASE_URI = '{}://{}:{}@{}:{}/{}'.format( 33 | os.getenv('DB_ENGINE' , 'mysql'), 34 | os.getenv('DB_USERNAME' , 'appseed_db_usr'), 35 | os.getenv('DB_PASS' , 'pass'), 36 | os.getenv('DB_HOST' , 'localhost'), 37 | os.getenv('DB_PORT' , 3306), 38 | os.getenv('DB_NAME' , 'appseed_db') 39 | ) 40 | 41 | class DebugConfig(Config): 42 | DEBUG = True 43 | 44 | 45 | # Load all possible configurations 46 | config_dict = { 47 | 'Production': ProductionConfig, 48 | 'Debug' : DebugConfig 49 | } 50 | -------------------------------------------------------------------------------- /apps/home/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | """ 3 | Copyright (c) 2019 - present AppSeed.us 4 | """ 5 | 6 | from flask import Blueprint 7 | 8 | blueprint = Blueprint( 9 | 'home_blueprint', 10 | __name__, 11 | url_prefix='' 12 | ) 13 | -------------------------------------------------------------------------------- /apps/home/routes.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | """ 3 | Copyright (c) 2019 - present AppSeed.us 4 | """ 5 | 6 | from apps.home import blueprint 7 | from flask import render_template, request 8 | from flask_login import login_required 9 | from jinja2 import TemplateNotFound 10 | 11 | 12 | @blueprint.route('/index') 13 | @login_required 14 | def index(): 15 | 16 | return render_template('home/index.html', segment='index') 17 | 18 | 19 | @blueprint.route('/