Burathar
5 years ago
7 changed files with 79 additions and 3 deletions
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
from flask import render_template |
||||
from app import app, db |
||||
|
||||
@app.errorhandler(404) |
||||
def not_found_error(error): |
||||
return render_template('404.html'), 404 |
||||
|
||||
@app.errorhandler(500) |
||||
def internal_error(error): |
||||
db.session.rollback() |
||||
return render_template('500.html'), 500 |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
{% extends "base.html" %} |
||||
|
||||
{% block app_content %} |
||||
<h1>File Not Found</h1> |
||||
<p><a href="{{ url_for('index') }}">Back</a></p> |
||||
{% endblock %} |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
{% extends "base.html" %} |
||||
|
||||
{% block app_content %} |
||||
<h1>An unexpected error has occurred</h1> |
||||
<p>The administrator has been notified. Sorry for the inconvenience!</p> |
||||
<p><a href="{{ url_for('index') }}">Back</a></p> |
||||
{% endblock %} |
@ -1,9 +1,19 @@
@@ -1,9 +1,19 @@
|
||||
import os |
||||
from dotenv import load_dotenv |
||||
from pathlib import Path |
||||
basedir = Path(__file__).parent.absolute() |
||||
load_dotenv(basedir / '.env') |
||||
|
||||
class Config(object): |
||||
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess' |
||||
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ |
||||
f"sqlite:///{Path(basedir) / 'app.db'}" |
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False |
||||
|
||||
LOG_TO_STDOUT = os.environ.get('LOG_TO_STDOUT') |
||||
MAIL_SERVER = os.environ.get('MAIL_SERVER') |
||||
MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25) |
||||
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None |
||||
MAIL_USERNAME = os.environ.get('MAIL_USERNAME') |
||||
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD') |
||||
ADMINS = ['your-email@example.com'] |
Loading…
Reference in new issue