Skip to content
Snippets Groups Projects
Commit 5490a371 authored by fcrisafulli-dev's avatar fcrisafulli-dev
Browse files

fix html files not being saved properly

parent 58ad0bed
No related branches found
No related tags found
No related merge requests found
...@@ -4,4 +4,5 @@ crisis_events.db ...@@ -4,4 +4,5 @@ crisis_events.db
backend/storage/0/steve.zip backend/storage/0/steve.zip
backend/storage/2/steve.zip backend/storage/2/steve.zip
*.txt *.txt
*.zip *.zip
\ No newline at end of file *.pyc
# Use the official Python 3.8 slim image as the base image
FROM python:3.8-slim
# Set the working directory within the container
WORKDIR /api-flask
# Copy the necessary files and directories into the container
# COPY resources/ static/ util/ .env application.py requirements.txt /api-flask/
# COPY resources/ /api-flask/resources/
# COPY static/ /api-flask/static/
# COPY util/ /api-flask/util/
# COPY .env application.py requirements.txt /api-flask/
COPY ./requirements.txt /api-flask/
COPY ./flask_backend.py /api-flask/
# Upgrade pip and install Python dependencies
RUN pip3 install --upgrade pip && pip install --no-cache-dir -r requirements.txt
# Expose port 5000 for the Flask application
EXPOSE 5000
# Define the command to run the Flask application using Gunicorn
CMD ["gunicorn", "application:app", "-b", "0.0.0.0:5000", "-w", "4"]
\ No newline at end of file
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
{"Users": 2, "Collections": 1}
\ No newline at end of file
...@@ -388,7 +388,8 @@ def v1_upload_raw_html(): ...@@ -388,7 +388,8 @@ def v1_upload_raw_html():
with zip_ref.open(file_name) as file: with zip_ref.open(file_name) as file:
content = file.read() content = file.read()
text = scraper.scrape_html(content) text = scraper.scrape_html(content)
file_path = f'./backend/storage/{collection_id}/{file_name}' new_file_name = file_name.split(".")[0]
file_path = f'./backend/storage/{collection_id}/{new_file_name}.txt'
with open(file_path, 'w', encoding='utf-8') as text_file: with open(file_path, 'w', encoding='utf-8') as text_file:
text_file.write(text) text_file.write(text)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment