Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
zesje
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Réouven ASSOULY
zesje
Commits
92745363
Commit
92745363
authored
7 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
make index function more pythonic
parent
4d42d05b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
zesje/__init__.py
+8
-6
8 additions, 6 deletions
zesje/__init__.py
with
8 additions
and
6 deletions
zesje/__init__.py
+
8
−
6
View file @
92745363
from
os
import
path
from
os.path
import
abspath
,
dirname
,
isfile
from
werkzeug.exceptions
import
NotFound
from
flask
import
Flask
from
flask_basicauth
import
BasicAuth
...
...
@@ -7,8 +9,7 @@ from . import db, api
static_folder_path
=
path
.
join
(
abspath
(
dirname
(
__file__
)),
'
static
'
)
app
=
Flask
(
__name__
,
static_folder
=
static_folder_path
)
app
=
Flask
(
__name__
,
static_folder
=
static_folder_path
)
db
.
use_db
()
...
...
@@ -23,7 +24,8 @@ app.register_blueprint(api.app, url_prefix='/api')
@app.route
(
'
/
'
)
@app.route
(
'
/<file>
'
)
def
index
(
file
=
''
):
if
not
isfile
(
path
.
join
(
static_folder_path
,
file
)):
file
=
'
index.html
'
return
app
.
send_static_file
(
file
)
\ No newline at end of file
def
index
(
file
=
'
index.html
'
):
try
:
return
app
.
send_static_file
(
file
)
except
NotFound
:
return
app
.
send_static_file
(
'
index.html
'
)
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