Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
mason-today-web
Commits
0c0bc39c
Commit
0c0bc39c
authored
Apr 27, 2018
by
Landon DeCoito
Browse files
renamed app.py to __init__.py and changed start.sh to comply
parent
8e6136c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
mason-today/
app
.py
→
mason-today/
__init__
.py
View file @
0c0bc39c
# flask imports
from
flask
import
Flask
from
flask
import
Flask
from
flask
import
Response
from
flask
import
Response
from
flask
import
render_template
# app imports
from
parscript
import
load_data
from
parscript
import
load_data
from
getconnectedscript
import
load_getconn_data
from
getconnectedscript
import
load_getconn_data
# python imports
import
json
import
json
app
=
Flask
(
__name__
)
app
=
Flask
(
__name__
)
@
app
.
route
(
"/"
)
@
app
.
route
(
"/"
)
def
display_default
():
def
display_default
():
resp
=
Response
((
"Welcome to the masontoday API! Go to https://git.gmu.edu/srct/mason-today-web <br/><br/>"
resp
=
render_template
(
'welcomepage.html'
)
+
"Feel free to go to /api/25live/ or /api/getconnected/ to find our api!"
).
encode
(
'utf-8'
))
return
resp
return
resp
@
app
.
route
(
"/api/25live"
)
@
app
.
route
(
"/api/25live"
)
def
display_data
():
def
display_data
():
resp
=
Response
(
json
.
dumps
(
load_data
(),
ensure_ascii
=
False
).
encode
(
'utf-8'
))
resp
=
Response
(
json
.
dumps
(
load_data
(),
ensure_ascii
=
False
)
.
encode
(
'utf-8'
))
resp
.
headers
[
'Content-Type'
]
=
'application/json; charset=utf-8'
resp
.
headers
[
'Content-Type'
]
=
'application/json; charset=utf-8'
return
resp
return
resp
@
app
.
route
(
"/api/getconnected"
)
@
app
.
route
(
"/api/getconnected"
)
def
display_GC_data
():
def
display_GC_data
():
resp
=
Response
(
json
.
dumps
(
load_getconn_data
(),
ensure_ascii
=
False
).
encode
(
'utf-8'
))
resp
=
Response
(
json
.
dumps
(
load_getconn_data
(),
ensure_ascii
=
False
)
.
encode
(
'utf-8'
))
resp
.
headers
[
'Content-Type'
]
=
'application/json; charset=utf-8'
resp
.
headers
[
'Content-Type'
]
=
'application/json; charset=utf-8'
return
resp
return
resp
start.sh
View file @
0c0bc39c
#!/bin/sh
#!/bin/sh
export
FLASK_APP
=
mason-today/
app
.py
export
FLASK_APP
=
mason-today/
__init__
.py
export
FLASK_DEBUG
=
1
export
FLASK_DEBUG
=
1
flask run
flask run
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment