Deploying custom font.css

I’m deploying an app with a custom font. Locally the font loads fine with the syntax below. I copied the font.css to the static folder as explained int this post. Does anyone have an idea on how to solve this?

with open( "font.css" ) as css:
    st.markdown( f'<style>{css.read()}</style>' , unsafe_allow_html= True)

When deploying the app on Streamlit Cloud I get the following error with Traceback (most recent call last):

  • File “/home/adminuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 535, in _run_script exec(code, module.dict)
  • File “/mount/src/final-project/package/app.py”, line 9, in
    with open( “font.css” ) as css:
  • FileNotFoundError: [Errno 2] No such file or directory: ‘font.css’

Link to full app script.

Hi @Bketting,

Thanks for sharing your question with the community! :balloon: Please update your debugging post to include a link to your app’s public GitHub repo – this will allow the community to help you find an answer as quickly as possible. In the meantime, this post will be tagged as needs-more-info.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.