Commit c0c6f288 authored by Moritz Sokoll's avatar Moritz Sokoll 🦀
Browse files

added pages folder for pages

parent db2ff54c
FROM python:latest
RUN apt-get update -y
COPY . /app
WORKDIR /app
RUN bash venv/bin/activate
RUN pip3 install -U pip
RUN pip3 install flask
EXPOSE 5000
CMD [ "python3", "src/app.py" ]
docker-build:
docker build -t ulublog:latest .
docker-run:
docker run --name blog -p5000:5000 -v`pwd`/src/pages:/app/src/pages ulublog:latest
from flask import Flask
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def index():
return "<h1>Index page</h1>"
return open("/app/src/pages/index.html", "r").read()
@app.route("/view")
def viewBlogPage():
if request.method != "GET":
return "please use the HTTP GET method to access this site"
if not "id" in request.args:
return "provide a blog id to view any article"
id = request.args['id']
# TODO: implement blog article view with 'id'
return f"viewing the article with id {id} will be implementet later"
@app.route("/about")
def about():
return open("/app/src/pages/about.html").read()
if __name__ == "__main__":
app.run("0.0.0.0", 5000, debug=True)
<!DOCTYPE html>
<html>
<head>
<title>About ULUdev's Blog</title>
</head>
<body>
<h1>About</h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>ULUdev's Blog</title>
<style>
body {
text-align: center;
font-family: Sans-Serif;
color: #969696;
background-color: #333333;
}
.navbar {
text-decoration: none;
}
/*
nav {
background-color: #333333;
color: #969696;
}
*/
nav *{
align: left;
display: inline;
margin-left: 3px;
}
</style>
</head>
<body>
<nav>
<h2>PyBlog</h2>
<a class="navbar" href="/about">about</a>
</nav>
<h1>ULUdev's Blog</h1>
<p>
Here will be something different later on. (No Sample Text)
This content will be recieved by an API.
</p>
<h2>Links</h2>
<div class="blog links">
<p>Later here will be some links to blog articles (retrieved by the API)</p>
</div>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment