mirror of
https://github.com/asimonson1125/asimonson1125.github.io.git
synced 2026-02-24 21:09:49 -06:00
silent bugs
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
react_OLD
|
||||
.git
|
||||
.gitignore
|
||||
.env
|
||||
.venv
|
||||
.vscode
|
||||
.git
|
||||
.git*
|
||||
__pycache__
|
||||
.claude
|
||||
CLAUDE.md
|
||||
README.md
|
||||
STATUS_MONITOR_README.md
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
notes.txt
|
||||
react_OLD
|
||||
__pycache__
|
||||
*.pyc
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,4 +7,5 @@ envs.py
|
||||
status_history.json
|
||||
|
||||
.claude
|
||||
CLAUDE.md
|
||||
CLAUDE.md
|
||||
.aider*
|
||||
|
||||
@@ -2,13 +2,9 @@ FROM python:3.10-bullseye
|
||||
LABEL maintainer="Andrew Simonson <asimonson1125@gmail.com>"
|
||||
|
||||
WORKDIR /app
|
||||
ADD ./src /app
|
||||
|
||||
COPY . .
|
||||
COPY src/ .
|
||||
|
||||
WORKDIR /app/src
|
||||
|
||||
RUN apt-get -yq update && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
CMD [ "gunicorn", "--bind", "0.0.0.0:8080", "app:app"]
|
||||
|
||||
@@ -7,3 +7,5 @@ So people can see how excellent my coding standards are.
|
||||
* Viruses: not included
|
||||
|
||||
You gotta uhh `pip3 install -r requirements.txt` and `python3 app.py` that thing
|
||||
|
||||
Docker compose configured to expose at `localhost:8080`
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
portfolio:
|
||||
image: 'asimonson1125/portfolio'
|
||||
@@ -6,3 +5,5 @@ services:
|
||||
context: ./
|
||||
dockerfile: Dockerfile
|
||||
restart: 'no'
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
||||
77
src/app.py
77
src/app.py
@@ -7,9 +7,6 @@ from monitor import monitor, SERVICES
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
# Start service monitoring
|
||||
monitor.start_monitoring()
|
||||
|
||||
# Add security and caching headers
|
||||
@app.after_request
|
||||
def add_security_headers(response):
|
||||
@@ -32,11 +29,15 @@ def add_security_headers(response):
|
||||
|
||||
|
||||
|
||||
proj = json.load(open("./static/json/projects.json", "r"))
|
||||
books = json.load(open("./static/json/books.json", "r"))
|
||||
skillList = json.load(open("./static/json/skills.json", "r"))
|
||||
timeline = json.load(open("./static/json/timeline.json", "r"))
|
||||
pages = json.load(open("./static/json/pages.json", "r"))
|
||||
def load_json(path):
|
||||
with open(path, "r") as f:
|
||||
return json.load(f)
|
||||
|
||||
proj = load_json("./static/json/projects.json")
|
||||
books = load_json("./static/json/books.json")
|
||||
skillList = load_json("./static/json/skills.json")
|
||||
timeline = load_json("./static/json/timeline.json")
|
||||
pages = load_json("./static/json/pages.json")
|
||||
|
||||
pages['projects']['skillList'] = skillList
|
||||
# pages['about']['timeline'] = timeline
|
||||
@@ -53,12 +54,13 @@ def api_status():
|
||||
@app.route('/api/goto/')
|
||||
@app.route('/api/goto/<location>')
|
||||
def goto(location='home'):
|
||||
if location not in pages:
|
||||
flask.abort(404)
|
||||
pagevars = pages[location]
|
||||
page = None
|
||||
try:
|
||||
page = flask.render_template(pagevars["template"], var=pagevars)
|
||||
except Exception as e:
|
||||
# raise e
|
||||
e = HTTPerror.InternalServerError(None, e)
|
||||
page = page404(e)
|
||||
return [pagevars, page]
|
||||
@@ -83,29 +85,45 @@ for i in pages:
|
||||
def resume():
|
||||
return flask.send_file("./static/Resume_Simonson_Andrew.pdf")
|
||||
|
||||
@app.errorhandler(Exception)
|
||||
@app.errorhandler(HTTPerror.HTTPException)
|
||||
def page404(e):
|
||||
eCode = e.code
|
||||
message = e.description
|
||||
try:
|
||||
message = e.length
|
||||
finally:
|
||||
pagevars = {
|
||||
"template": "error.html",
|
||||
"title": f"{eCode} - Simonson",
|
||||
"description": "Error on Andrew Simonson's Digital Portfolio",
|
||||
"canonical": "404",
|
||||
}
|
||||
return (
|
||||
flask.render_template(
|
||||
"header.html",
|
||||
var=pagevars,
|
||||
error=eCode,
|
||||
message=message,
|
||||
title=f"{eCode} - Simonson Portfolio",
|
||||
),
|
||||
eCode,
|
||||
)
|
||||
pagevars = {
|
||||
"template": "error.html",
|
||||
"title": f"{eCode} - Simonson",
|
||||
"description": "Error on Andrew Simonson's Digital Portfolio",
|
||||
"canonical": "404",
|
||||
}
|
||||
return (
|
||||
flask.render_template(
|
||||
"header.html",
|
||||
var=pagevars,
|
||||
error=eCode,
|
||||
message=message,
|
||||
title=f"{eCode} - Simonson Portfolio",
|
||||
),
|
||||
eCode,
|
||||
)
|
||||
|
||||
@app.errorhandler(Exception)
|
||||
def page500(e):
|
||||
pagevars = {
|
||||
"template": "error.html",
|
||||
"title": "500 - Simonson",
|
||||
"description": "Error on Andrew Simonson's Digital Portfolio",
|
||||
"canonical": "404",
|
||||
}
|
||||
return (
|
||||
flask.render_template(
|
||||
"header.html",
|
||||
var=pagevars,
|
||||
error=500,
|
||||
message="Internal Server Error",
|
||||
title="500 - Simonson Portfolio",
|
||||
),
|
||||
500,
|
||||
)
|
||||
|
||||
|
||||
@app.route("/sitemap.xml")
|
||||
@@ -121,3 +139,4 @@ if __name__ == "__main__":
|
||||
app.run(debug=False)
|
||||
else:
|
||||
Minify(app=app, html=True, js=True, cssless=True)
|
||||
monitor.start_monitoring()
|
||||
|
||||
@@ -236,10 +236,16 @@ function refreshStatus() {
|
||||
/**
|
||||
* Initialize on page load
|
||||
*/
|
||||
let statusIntervalId = null;
|
||||
|
||||
function initStatusPage() {
|
||||
// Clear any existing interval from a previous SPA navigation
|
||||
if (statusIntervalId !== null) {
|
||||
clearInterval(statusIntervalId);
|
||||
}
|
||||
fetchStatus();
|
||||
// Auto-refresh every 5 minutes to get latest data
|
||||
setInterval(fetchStatus, 300000);
|
||||
statusIntervalId = setInterval(fetchStatus, 300000);
|
||||
}
|
||||
|
||||
// Start when page loads
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
property="og:image"
|
||||
content="{{ url_for('static', filename='icons/rasterLogoCircle.png') }}"
|
||||
/>
|
||||
<meta property="og:url" content="{{ var['description'] }}" />
|
||||
<meta property="og:url" content="{{ var['canonical'] }}" />
|
||||
<meta property="twitter:title" content="Andrew Simonson" />
|
||||
<meta name="twitter:description" content="{{ var['description'] }}" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
|
||||
@@ -17,13 +17,15 @@
|
||||
<p>{{ content }}</p>
|
||||
<div class="projLinks">
|
||||
{% for i in links %} {% set src = 'icons/' + i[0] + '.svg' %}
|
||||
<a href="{{i[1]}}">
|
||||
{% if i[1].startswith('https://') or i[1].startswith('http://') %}
|
||||
<a href="{{i[1]}}" rel="noopener noreferrer">
|
||||
<img
|
||||
class="projectLink"
|
||||
src="{{ url_for('static', filename=src) }}"
|
||||
alt="{{i[0]}}"
|
||||
/>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user