Compare commits
2 commits
2613f185f3
...
f97e52fb29
Author | SHA256 | Date | |
---|---|---|---|
f97e52fb29 | |||
43a6d7d22b |
3 changed files with 32 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
.venv/
|
||||
visitorCount.txt
|
||||
|
|
19
site/app.py
19
site/app.py
|
@ -4,9 +4,26 @@ from flask import Flask, render_template, make_response
|
|||
|
||||
app = Flask(__name__)
|
||||
|
||||
countFile = "visitorCount.txt"
|
||||
|
||||
def get_visitor_count():
|
||||
try:
|
||||
with open(countFile, "r") as f:
|
||||
return int(f.read())
|
||||
except FileNotFoundError:
|
||||
return 0
|
||||
|
||||
def increment_visitor_count():
|
||||
count = get_visitor_count()
|
||||
count += 1
|
||||
with open(countFile, "w") as f:
|
||||
f.write(str(count))
|
||||
return count
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.j2')
|
||||
increment_visitor_count()
|
||||
return render_template('index.j2', visitor=get_visitor_count())
|
||||
|
||||
@app.route('/assets/index.css')
|
||||
def indexStyle():
|
||||
|
|
|
@ -9,6 +9,15 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<center>
|
||||
<p>
|
||||
hello, visitor number <b>{{ visitor }}</b>! this one is glad to see you.
|
||||
</p>
|
||||
<br>
|
||||
<small>
|
||||
this counter doesn't use javascript, it's just a text file with a digit in it that gets increased by 1 on every page load.
|
||||
</small>
|
||||
</center>
|
||||
<h1>
|
||||
Nyx Tutt
|
||||
</h1>
|
||||
|
@ -32,7 +41,7 @@
|
|||
<a href="matrix:u/n:everypizza.im">matrix</a><br>
|
||||
</li>
|
||||
<li>
|
||||
<a href="mailto:me@everypizza.im">email</a> (it has a pgp key in one of the key servers.)<br>
|
||||
<a href="mailto:me@everypizza.im">email</a> (it has a pgp key over in <a href="https://keys.openpgp.org/search?q=me%40everypizza.im">keys.openpgp.org</a>.)<br>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://sharkey.everypizza.im">fedi</a><br>
|
||||
|
@ -50,6 +59,9 @@
|
|||
<li>
|
||||
<a href="https://everypizza.im/">everypizza.im</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://git.everypizza.im/n/">git</a>
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
<h2>
|
||||
|
|
Loading…
Add table
Reference in a new issue