diff --git a/.env b/.env new file mode 100644 index 0000000..4438f80 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +HOST=0.0.0.0 +PORT=8050 \ No newline at end of file diff --git a/.env_example b/.env_example new file mode 100644 index 0000000..4438f80 --- /dev/null +++ b/.env_example @@ -0,0 +1,2 @@ +HOST=0.0.0.0 +PORT=8050 \ No newline at end of file diff --git a/app/app.py b/app/app.py index cf92336..9e5ad35 100644 --- a/app/app.py +++ b/app/app.py @@ -128,12 +128,14 @@ def parse_uploaded_file_contents(list_of_file_contents, list_of_file_names): if not os.path.exists(USER_FILE_UPLOAD_DIRECTORY): + logger.info(f"Creating the user file upload directory: {USER_FILE_UPLOAD_DIRECTORY}." ) os.makedirs(USER_FILE_UPLOAD_DIRECTORY) for file_content, file_name in zip(list_of_file_contents, list_of_file_names): uploaded_file_data = file_content.encode("utf8").split(b";base64,")[1] with open(os.path.join(USER_FILE_UPLOAD_DIRECTORY, file_name), "wb") as uploaded_file: + logger.info(f"Writing file: {file_name}...") uploaded_file.write(base64.decodebytes(uploaded_file_data)) # return an html Div of the uploaded file names to display to the user @@ -155,5 +157,8 @@ def update_output(list_of_contents, list_of_names): if __name__ == '__main__': - logger.info("Starting the Dash Plotly app...") - app.run(debug=True, host='0.0.0.0', port=8050) \ No newline at end of file + host = os.environ.get("HOST") + port = int(os.environ.get("PORT", 8050)) + + logger.info(f"Starting the Hinge Data Analysis app on {host}:{port}...") + app.run(debug=True, host=host, port=port) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 4f86ebc..0dac324 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,6 +21,7 @@ packaging==24.2 pandas==2.2.3 plotly==6.0.0 python-dateutil==2.9.0.post0 +python-dotenv==1.0.1 pytz==2025.1 requests==2.32.3 retrying==1.3.4