Adding a page for /upload with instructions
This commit is contained in:
parent
eb4436259d
commit
de57a1fbb1
4 changed files with 15 additions and 2 deletions
|
@ -28,6 +28,7 @@
|
||||||
<div class="navbar-collapse collapse">
|
<div class="navbar-collapse collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li><a href="/">Home</a></li>
|
<li><a href="/">Home</a></li>
|
||||||
|
<li><a href="/upload">Upload</a></li>
|
||||||
<li><a href="//github.com/Metonimie/benchmark-scoreboard">Fork this Website</a></li>
|
<li><a href="//github.com/Metonimie/benchmark-scoreboard">Fork this Website</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
12
src/templates/upload.html
Normal file
12
src/templates/upload.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{% extends "mybase.html" %}
|
||||||
|
{% block title %}FOTB - Uploading{% endblock %}
|
||||||
|
|
||||||
|
{% block main %}
|
||||||
|
{{ super() }}
|
||||||
|
<div>
|
||||||
|
<h4>Uploading Data</h4>
|
||||||
|
<p>Uploading data is simple, all you need to is send a POST request with content-type <code>application/json</code> to this URL.</p>
|
||||||
|
<p>Your JSON must respect all the required fields.</p>
|
||||||
|
<p>Example: <code>curl -H "Content-Type: application/json" -X POST -d '{"gpu":"GPU DUMMY TEXT","cpu":"CPU DUMMY TEXT","log":"So this will be a detailed log.","score": 1}' http://localhost:5000/upload</code></p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -34,7 +34,7 @@ def upload():
|
||||||
an error string.
|
an error string.
|
||||||
"""
|
"""
|
||||||
if flask.request.method == 'GET':
|
if flask.request.method == 'GET':
|
||||||
flask.abort(404)
|
return flask.render_template('upload.html')
|
||||||
|
|
||||||
content = flask.request.get_json()
|
content = flask.request.get_json()
|
||||||
|
|
||||||
|
|
|
@ -68,4 +68,4 @@ class ScoreboardTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_get_upload(self):
|
def test_get_upload(self):
|
||||||
response = self.client.get('/upload')
|
response = self.client.get('/upload')
|
||||||
self.assertEqual(response.status_code, 404)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
Loading…
Reference in a new issue