Added optional port to flasksite
Changed path to file upload Change-Id: I05bf7020d6548b46a1f40b6749b9bec10ad5a322
This commit is contained in:
parent
b9a9e94c26
commit
a4939289c5
@ -14,6 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
from sys import argv
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask import make_response
|
from flask import make_response
|
||||||
@ -49,7 +50,7 @@ def test_host_header():
|
|||||||
@app.route('/hello/<user_name>/upload/', methods=['GET', 'POST'])
|
@app.route('/hello/<user_name>/upload/', methods=['GET', 'POST'])
|
||||||
def upload_file(user_name):
|
def upload_file(user_name):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form.photo.data.save('/var/www/uploads/{0}.jpg'.format(user_name))
|
form.photo.data.save('/tmp/{0}.jpg'.format(user_name))
|
||||||
else:
|
else:
|
||||||
return render_template('gorilla.html', name=user_name)
|
return render_template('gorilla.html', name=user_name)
|
||||||
|
|
||||||
@ -101,5 +102,10 @@ def test_expires_and_cache_control():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
if len(argv) > 1:
|
||||||
|
port = int(argv[1])
|
||||||
|
else:
|
||||||
|
port = 80
|
||||||
|
|
||||||
app.debug = True
|
app.debug = True
|
||||||
app.run(host='0.0.0.0', port=80)
|
app.run(host='0.0.0.0', port=port)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user