Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Webapps Deliverer
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
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
vaclab
Webapps Deliverer
Commits
f6c9e587
Commit
f6c9e587
authored
4 years ago
by
Rolf Niepraschk
Browse files
Options
Downloads
Patches
Plain Diff
data path
parent
24918b85
No related branches found
Branches containing commit
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server
+7
-1
7 additions, 1 deletion
server
server.py
+7
-6
7 additions, 6 deletions
server.py
with
14 additions
and
7 deletions
server
+
7
−
1
View file @
f6c9e587
#!/bin/bash
if
[
-z
"
$1
"
]
;
then
echo
"error: missing data path"
exit
-1
fi
export
FLASK_APP
=
server.py
export
FLASK_DEBUG
=
1
export
FLASK_ENV
=
development
# TODO: FLASK_ENV=production
...
...
@@ -6,4 +12,4 @@ export FLASK_ENV=development # TODO: FLASK_ENV=production
python3
-m
venv ./
source
bin/activate
pip3
install
-e
.
python3 server.py
python3 server.py
"
$1
"
This diff is collapsed.
Click to expand it.
server.py
+
7
−
6
View file @
f6c9e587
...
...
@@ -2,10 +2,11 @@
from
flask
import
Flask
,
Response
,
request
,
send_from_directory
from
flask_cors
import
CORS
from
urllib.parse
import
urlparse
import
requests
,
json
import
sys
,
requests
app
=
Flask
(
__name__
)
DATA_PATH
=
sys
.
argv
[
1
]
COUCHDB_PROTO
=
'
http
'
COUCHDB_PORT
=
'
5984
'
DB
=
'
vl_db
'
...
...
@@ -18,27 +19,27 @@ CORS(app)
@app.route
(
'
/<fn>
'
,
methods
=
[
'
GET
'
])
def
html
(
fn
):
app
.
logger
.
debug
(
'
hit html folder:
'
+
fn
)
return
send_from_directory
(
'
./data
/web-apps
'
,
fn
)
return
send_from_directory
(
DATA_PATH
+
'
/web-apps
'
,
fn
)
@app.route
(
'
/js/<path:fn>
'
,
methods
=
[
'
GET
'
])
def
js
(
fn
):
app
.
logger
.
debug
(
'
hit js folder:
'
+
fn
)
return
send_from_directory
(
'
data
/web-apps/js
'
,
fn
)
return
send_from_directory
(
DATA_PATH
+
'
/web-apps/js
'
,
fn
)
@app.route
(
'
/css/<fn>
'
,
methods
=
[
'
GET
'
])
def
css
(
fn
):
app
.
logger
.
debug
(
'
hit css folder:
'
+
fn
)
return
send_from_directory
(
'
data
/web-apps/css
'
,
fn
)
return
send_from_directory
(
DATA_PATH
+
'
/web-apps/css
'
,
fn
)
@app.route
(
'
/img/<fn>
'
,
methods
=
[
'
GET
'
])
def
img
(
fn
):
app
.
logger
.
debug
(
'
hit img folder:
'
+
fn
)
return
send_from_directory
(
'
data
/web-apps/img
'
,
fn
)
return
send_from_directory
(
DATA_PATH
+
'
/web-apps/img
'
,
fn
)
@app.route
(
'
/lib/<path:fn>
'
,
methods
=
[
'
GET
'
])
def
lib
(
fn
):
app
.
logger
.
debug
(
'
hit lib folder:
'
+
fn
)
return
send_from_directory
(
'
data
/lib
'
,
fn
)
return
send_from_directory
(
DATA_PATH
+
'
/lib
'
,
fn
)
'''
The following works like a proxy server:
...
...
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