Skip to content

Commit fb848ac

Browse files
author
2knal
committed
Display Markdown at root
Displaying cache_server README.md at / route.
1 parent c6a8ab6 commit fb848ac

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

random_proxies/cache/app.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@
44
from random_proxies.cache import db
55
from random_proxies.cache import logger
66

7+
import os
8+
from os.path import join, dirname
79
from random import choice
810
from flask import Flask, request, jsonify
11+
from markdown import markdown
912

1013
app = Flask(__name__)
1114

1215
@app.route('/')
1316
def index():
14-
return "It works!"
17+
try:
18+
with open(join(dirname(__file__), 'README.md')) as f:
19+
markdown_file = f.read()
20+
return markdown(markdown_file)
21+
except Exception as e:
22+
return "It works"
1523

1624
@app.route('/fetch', methods=['GET'])
1725
def fetch():

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ idna==2.9
88
itsdangerous==1.1.0
99
Jinja2==2.11.2
1010
lxml==4.5.0
11+
Markdown==3.2.1
1112
MarkupSafe==1.1.1
1213
pymongo==3.10.1
1314
PySocks==1.7.1

0 commit comments

Comments
 (0)