Skip to content

Commit

Permalink
Removed __init__ pycache
Browse files Browse the repository at this point in the history
added mail settings
added errors.py
added custom error views
  • Loading branch information
JayKayAce committed Jul 12, 2019
1 parent 1b07f59 commit 563c18a
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 2 deletions.
Binary file modified app.db
Binary file not shown.
4 changes: 3 additions & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@
login = LoginManager(app)
login.login_view = "login" # Requires login at first visit

from app import routes, models
from app import routes
from app import models
from app import errors
Binary file removed app/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
13 changes: 13 additions & 0 deletions app/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from flask import render_template

from app import app
from app import 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
6 changes: 6 additions & 0 deletions app/templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "base.html" %}

{% block content %}
<h1>File Not found</h1>
<p><a href="{{ url_for('index') }}">Back</a></p>
{% endblock %}
7 changes: 7 additions & 0 deletions app/templates/500.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "base.html" %}

{% block content %}
<h1>An unexpected error has occurred</h1>
<p>The Adminstrator has been notified, Sorry for the inconvenience</p>
<p><a href="{{ url_for('index') }}">Back</a></p>
{% endblock %}
8 changes: 7 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ class Config:
SECRET_KEY = os.environ.get("SECRET_KEY") or "you-will-never-guess"
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL") or \
'sqlite:///'+os.path.join(basedir,"app.db")
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
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 = ["[email protected]"]

0 comments on commit 563c18a

Please sign in to comment.