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