Flask render template doesn't render my html page keep getting "internal server error"

Advertisements Running flask 2.1 w/ python 3.10 trying to create a small app here’s my main.py file contents and directory setup from waitress import serve app = Flask(__name__, template_folder=’/templates’) @app.route("/") def startService(): return "Simple Web app" @app.route("/home") def ohok(): return render_template(‘home.html’) if __name__ == "__main__": serve(app, host="127.0.0.1", port=8080) I have my home.html file correctly formatted… Read More Flask render template doesn't render my html page keep getting "internal server error"

datetime reading a different format from the real value

Advertisements I’m trying to reformat a datetime pattern on csv’s files: Original date format: DAY/MONTH/YEAR Expected Result: YEAR/MONTH/DAY rows = df[‘clock_now’] is: 22/05/2022 12:16 22/05/2022 12:20 22/05/2022 12:21 22/05/2022 12:44 22/05/2022 12:47 22/05/2022 12:47 22/05/2022 12:51 Here is my complete code: import pandas as pd import datetime filials= [ ‘base.csv’, ‘max.csv’ ] for filial in… Read More datetime reading a different format from the real value

Why is this requests get not working with this url

Advertisements If i run this Python code my program just hangs up. (I don`t get any error.) import requests url = "https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/generative/dcgan.ipynb" r = requests.get(url) But this works perfectly fine as expected. import requests url = "https://stackoverflow.com" r = requests.get(url) Using curl to get the github file worked also fine. curl https://raw.githubusercontent.com/tensorflow/docs/master/site/en/tutorials/generative/dcgan.ipynb So can you… Read More Why is this requests get not working with this url

pip and python referring to different interpreters

Advertisements I know "multiple-versions-of-python-mess" is nothing new but my question is more specific. I’m learning how to use venv (and pyenv, etc.) and I’ve run into a strange situation. I have a number of different versions of python installed (as one does). I use one of them, 3.9, to create a venv: $ /usr/local/Cellar/python@3.9/3.9.12_1/bin/python3 -m… Read More pip and python referring to different interpreters

How to make docker-build to cache the pip installs as well?

Advertisements I am working with the following Dockerfile. FROM ubuntu RUN apt-get update RUN apt-get install -y \ python3.9 \ python3-pip COPY . /app WORKDIR /app RUN pip install -r requirements.txt EXPOSE 8501 ENTRYPOINT [ "streamlit", "run" ] CMD ["app.py"] Whenever, I rebuild the image, the docker uses the previously cached version of image and… Read More How to make docker-build to cache the pip installs as well?