|
@@ -1,5 +1,5 @@
|
1
|
1
|
import os
|
2
|
|
-from flask import Flask, send_from_directory, jsonify
|
|
2
|
+from flask import Flask, send_from_directory, jsonify, current_app
|
3
|
3
|
from flask_cors import CORS, cross_origin
|
4
|
4
|
|
5
|
5
|
|
|
@@ -20,8 +20,8 @@ def send_text_file(article):
|
20
|
20
|
@cross_origin(origin="localhost", headers=["Content-Type", "Authorization"])
|
21
|
21
|
def list_files():
|
22
|
22
|
files = list()
|
23
|
|
- for filename in os.listdir("articles"):
|
24
|
|
- path = os.path.join("articles", filename)
|
|
23
|
+ for filename in os.listdir(os.path.join(current_app.root_path, "articles")):
|
|
24
|
+ path = os.path.join(current_app.root_path, "articles", filename)
|
25
|
25
|
if os.path.isfile(path):
|
26
|
26
|
files.append(filename)
|
27
|
27
|
return jsonify(files)
|