Skip to content
Snippets Groups Projects
Commit 7b960ca3 authored by Felix Chadwick-Smith's avatar Felix Chadwick-Smith
Browse files

added forms.py for Flask WTF to add project

parent b8910316
Branches
No related tags found
1 merge request!20Master
......@@ -76,9 +76,10 @@ def download_cv():
@app.route('/download_assessment/<filename>')
def download_assessment(filename):
try:
file_path = f'static/{filename}'
file_path = os.path.join('static', filename)
print(f"Attempting to serve file: {file_path}")
return send_from_directory('static', filename, as_attachment=True)
return send_from_directory(app.static_folder, filename, as_attachment=True)
except FileNotFoundError:
print(f"File not found: {file_path}")
abort(404) # Return a 404 Not Found error
......@@ -86,8 +87,7 @@ def download_assessment(filename):
print(f"Error serving assessment file: {str(e)}")
current_app.logger.exception(f"Error serving assessment file: {str(e)}")
abort(500)
if __name__ == '__main__':
with app.app_context():
db.create_all()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment