add: display home markdown
This commit is contained in:
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
__pycache__
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
.git
|
||||||
|
.env
|
||||||
|
tests/
|
||||||
|
docs/
|
||||||
17
Dockerfile
17
Dockerfile
@@ -1,20 +1,15 @@
|
|||||||
FROM python:3.12-slim
|
FROM python:3.12-slim
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE 1
|
ENV PYTHONDONTWRITEBYTECODE 1
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apt-get update &&\
|
RUN apt-get update &&\
|
||||||
apt-get install -y \
|
apt-get install -y default-mysql-client &&\
|
||||||
default-mysql-client &&\
|
apt-get clean &&\
|
||||||
apt-get clean
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY requirements.txt /app/
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
|
COPY requirements.txt ./requirements.txt
|
||||||
|
RUN pip install --no-cache-dir -r ./requirements.txt
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
CMD ["python", "app.py"]
|
CMD ["python", "app.py"]
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
#api/markdown.py
|
|
||||||
from flask import Blueprint, request, jsonify
|
from flask import Blueprint, request, jsonify
|
||||||
|
|
||||||
import api
|
import api
|
||||||
from api import require_auth, etag_response
|
from api import require_auth, etag_response
|
||||||
from contexts.RequestContext import RequestContext
|
from contexts.RequestContext import RequestContext
|
||||||
@@ -20,6 +18,15 @@ def get_markdowns():
|
|||||||
mds = session.query(Markdown).all()
|
mds = session.query(Markdown).all()
|
||||||
return jsonify([md.to_dict() for md in mds]), 200
|
return jsonify([md.to_dict() for md in mds]), 200
|
||||||
|
|
||||||
|
@markdown_bp.route('/get_home', methods=['GET'])
|
||||||
|
@limiter.limit(api.get_rate_limit)
|
||||||
|
@etag_response
|
||||||
|
def get_home():
|
||||||
|
with get_db() as session:
|
||||||
|
markdown = session.query(Markdown).filter(Markdown.path_id == 1).filter(Markdown.title == "index").first()
|
||||||
|
if markdown is None:
|
||||||
|
return jsonify({}), 204
|
||||||
|
return jsonify(markdown.to_dict()), 200
|
||||||
@markdown_bp.route('/by_path/<int:path_id>', methods=['GET'])
|
@markdown_bp.route('/by_path/<int:path_id>', methods=['GET'])
|
||||||
@limiter.limit(api.get_rate_limit)
|
@limiter.limit(api.get_rate_limit)
|
||||||
@etag_response
|
@etag_response
|
||||||
|
|||||||
Reference in New Issue
Block a user