diff --git a/C2051326_report.pdf b/C2051326_report.pdf index cc4f46eb24da6a4b35bd1ddfef4adc6ac88ef43e..8d2abad38fae89ce6f71d6c8767b7e566ae03627 100644 Binary files a/C2051326_report.pdf and b/C2051326_report.pdf differ diff --git a/Website Report CMT120.pdf b/Website Report CMT120.pdf deleted file mode 100644 index f06b6e5f4d96fbe4a5dcc050889868d3f3f591e9..0000000000000000000000000000000000000000 Binary files a/Website Report CMT120.pdf and /dev/null differ diff --git a/__pycache__/my_flask_app.cpython-311.pyc b/__pycache__/my_flask_app.cpython-311.pyc index 52554400f2cb5479b64853d69613e9274090fad9..65fd315bc5b4152bc94f574d3c7f22a39df33001 100644 Binary files a/__pycache__/my_flask_app.cpython-311.pyc and b/__pycache__/my_flask_app.cpython-311.pyc differ diff --git a/my_flask_app.py b/my_flask_app.py index faef2b6e5d7975deedc6b355cd4901fcec2a5318..004ca8e7087be48b5479ca8e87209f2b31c7a7d9 100644 --- a/my_flask_app.py +++ b/my_flask_app.py @@ -1,6 +1,9 @@ +#https://users.cs.cf.ac.uk/MoloughneyMJ/FlaskReference/FlaskCribSheets very helpful for setting it up for the first time +#https://realpython.com/flask-project/#create-a-virtual-environment - showed me how to expand on inital setup import os import secrets from flask import Flask, render_template, request, redirect, flash +#https://flask.palletsprojects.com/en/3.0.x/quickstart/#a-minimal-application for inital flask set up from flask import Flask, render_template, request, redirect, url_for, send_from_directory, abort, current_app from flask_sqlalchemy import SQLAlchemy from flask_wtf import FlaskForm @@ -10,6 +13,8 @@ from wtforms.validators import DataRequired app = Flask(__name__, static_folder='static') app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0 +#https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iv-database +#https://realpython.com/flask-by-example-part-2-postgres-sqlalchemy-and-alembic/ app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.abspath(os.path.join(os.path.dirname(__file__), 'instance/site.db')) app.config['SECRET_KEY'] = secrets.token_hex(16) @@ -24,6 +29,7 @@ class ProjectForm(FlaskForm): title = StringField('Title', validators=[DataRequired()]) description = TextAreaField('Description', validators=[DataRequired()]) submit = SubmitField('Add Project') + #https://flask.palletsprojects.com/en/3.0.x/quickstart/#a-minimal-application - Routes for developing my routes for each page @app.route('/') def home(): @@ -75,6 +81,7 @@ def add_project(): return render_template('add_project.html', form=form) # Updated route for serving the 'my-cv.docx' file @app.route('/download_cv') +#https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xx-some-javascript-magic def download_cv(): file_path = 'static/my-cv.docx' print(f"Attempting to serve file: {file_path}") @@ -99,4 +106,5 @@ def download_assessment(filename): if __name__ == '__main__': with app.app_context(): db.create_all() + #https://flask.palletsprojects.com/en/3.0.x/quickstart/#a-minimal-application for learning how to debug app.run(debug=False, port=int(os.environ.get('PORT', 8080))) \ No newline at end of file diff --git a/templates/add_project.html b/templates/add_project.html index 0d1168e39700dbaeca9b1534cda4576deda6b677..c1400dff055570ba0d6b029f90e006634045fd21 100644 --- a/templates/add_project.html +++ b/templates/add_project.html @@ -16,6 +16,7 @@ </head> <body class="home-page"> + <!---https://realpython.com/flask-project/#create-a-virtual-environment---> <nav> <ul> <li><a href="{{ url_for('home') }}">Home</a></li> @@ -27,6 +28,7 @@ </ul> </nav> <h2>Add Project</h2> + <!---https://realpython.com/flask-project/#create-a-virtual-environment---> <form method="POST" action="{{ url_for('add_project') }}"> {% with messages = get_flashed_messages() %} {% if messages %} @@ -36,7 +38,7 @@ {% endfor %} </ul> {% endif %} - {% endwith %} + {% endwith %} {% if form %} {{ form.csrf_token }} <div class="form-group"> diff --git a/templates/index.html b/templates/index.html index 37747fb1602f1753a95a023c52c120c013b80079..bd29d6fe5349836388aa5c8b23d5795e012730d6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,3 +1,4 @@ +<!---https://css-tricks.com/crafting-reusable-html-templates/--> <!DOCTYPE html> <html lang="en"> <head> diff --git a/work-1.png b/work-1.png deleted file mode 100644 index 7f335fcdb5543404d1278977bea8438ea877642d..0000000000000000000000000000000000000000 Binary files a/work-1.png and /dev/null differ diff --git a/work-3.png b/work-3.png deleted file mode 100644 index 7941946ddc22d4281448b0fdcb5399e7e6680716..0000000000000000000000000000000000000000 Binary files a/work-3.png and /dev/null differ