Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Moritz Sokoll
PyBlog
Commits
c0c6f288
Commit
c0c6f288
authored
Feb 20, 2021
by
Moritz Sokoll
🦀
Browse files
added pages folder for pages
parent
db2ff54c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
c0c6f288
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" ]
Makefile
View file @
c0c6f288
docker-build
:
docker build
-t
ulublog:latest .
docker-run
:
docker run
--name
blog
-p5000
:5000
-v
`
pwd
`
/src/pages:/app/src/pages ulublog:latest
src/app.py
View file @
c0c6f288
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
)
src/pages/about.html
0 → 100644
View file @
c0c6f288
<!DOCTYPE html>
<html>
<head>
<title>
About ULUdev's Blog
</title>
</head>
<body>
<h1>
About
</h1>
</body>
</html>
src/pages/index.html
0 → 100644
View file @
c0c6f288
<!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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment