Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
get_start_flask
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ishan Patel
get_start_flask
Commits
df1d30c4
Commit
df1d30c4
authored
7 years ago
by
Bo-Chun Chen
Browse files
Options
Downloads
Patches
Plain Diff
Made use of app.errorhandler
parent
1ed20244
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/__init__.py
+14
-1
14 additions, 1 deletion
app/__init__.py
with
14 additions
and
1 deletion
app/__init__.py
+
14
−
1
View file @
df1d30c4
# third-party imports
from
flask
import
Flask
from
flask
import
Flask
,
render_template
from
flask_sqlalchemy
import
SQLAlchemy
from
flask_login
import
LoginManager
from
flask_migrate
import
Migrate
...
...
@@ -35,4 +35,17 @@ def create_app(config_name):
from
.home
import
home
as
home_blueprint
app
.
register_blueprint
(
home_blueprint
)
@app.errorhandler
(
403
)
def
forbidden
(
error
):
return
render_template
(
'
errors/403.html
'
,
title
=
'
Forbidden
'
),
403
@app.errorhandler
(
404
)
def
page_not_found
(
error
):
return
render_template
(
'
errors/404.html
'
,
title
=
'
Page Not Found
'
),
404
@app.errorhandler
(
500
)
def
internal_server_error
(
error
):
return
render_template
(
'
errors/500.html
'
,
title
=
'
Server Error
'
),
500
return
app
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment