Hello Randy Thank you for getting back on this issue. I cant even begin to explain how many different configurations I have tried to make this work correctly. Then this evening I was getting ready to send over my code to get a second set of eyes and I had one last idea on what might be causing the issue. The message says it has to be the first streamlit command called in the app and only called one time. I followed both of those rules even searching my entire repository for any other mention of this command to ensure I didnt accidently add it somewhere.
Tonight I had the thought to put the st.set_page_config() command at the very top of my app.py file.
On the very first line before anything else I entered this:
1 import streamlit as st
2 st.set_page_config(
page_title=xxx,
page_icon=chart_with_upwards_trend,
layout=“wide”,
initial_sidebar_state=“auto”,
menu_items=None,
)
When I ran it on the local no issues. I pushed it up to my github repository for the deployed app to access then rebooted the application from the https://share.streamlit.io/ app management page. And the issue was resolved. I hope this helps!
import streamlit as st
st.set_page_config(
page_title="4M",
page_icon="chart_with_upwards_trend",
layout="wide",
initial_sidebar_state="expanded",
menu_items={
'Get Help': 'https://www.extremelycoolapp.com/help',
'Report a bug': "https://www.extremelycoolapp.com/bug",
'About': "# > Creator: Gordon D. Pisciotta · 4M · [modern.millennial.market.mapping]",
}
)
st.markdown(
f"""
<style>
#.reportview-container .main .block-container{{
padding-top: {1.3}rem;
padding-right: {2.5}rem;
padding-left: {3.4}rem;
padding-bottom: {3.4}rem;
}}
</style>
""",
unsafe_allow_html=True
)
st.markdown(
"""
<style>
MainMenu {visibility: hidden;}
footer {visibility: hidden;}
footer:after {
content:" · modern.millennial.market.mapping · ";
visibility: visible;
display: block;
position: 'fixed';
#background-color: red;
padding: 5px;
top: 2px;
}
</style>
"""
, unsafe_allow_html=True
)
import warnings
warnings.filterwarnings("ignore")
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from datetime import datetime
import pages as p1
from src.tools import lists as l0
from src.tools import scripts as s0
pd.options.display.max_columns = None
pd.options.display.max_rows = None
pd.set_option("display.width", None)
pd.set_option("display.max_colwidth", -1)
pd.options.display.float_format = "{:,}".format
mpl.use("Agg")
plt.style.use("ggplot")
sm, med, lg = 10, 15, 20
plt.rc("font", size=sm) # controls default text sizes
plt.rc("axes", titlesize=med) # fontsize of the axes title
plt.rc("axes", labelsize=med) # fontsize of the x & y labels
plt.rc("xtick", labelsize=sm) # fontsize of the tick labels
plt.rc("ytick", labelsize=sm) # fontsize of the tick labels
plt.rc("legend", fontsize=sm) # legend fontsize
plt.rc("figure", titlesize=lg) # fontsize of the figure title
plt.rc("axes", linewidth=2) # linewidth of plot lines
plt.rcParams["figure.figsize"] = [18, 10]
plt.rcParams["figure.dpi"] = 150
# ------------------------------------------------------------ > page: [LOGIN_PG]
def page_login(today_stamp):
authUser = p1.Credentials(today_stamp).check_password()
return authUser
# ------------------------------------------------------------ > page: [HOME_PAGE]
def page_home():
p1.Home(l0.general_pages).run_home()
# ------------------------------------------------------------ > page: [SNAPSHOT]
def page_snapshot(today_stamp):
p1.Snapshot(today_stamp).run_mkt_snap()
# ------------------------------------------------------------ > page: [PROOF]
def page_proof():
p1.Proof().prove_it()
# ------------------------------------------------------------ > page: [HUDDLE]
def huddle_up():
st.header("coming soon")
# ------------------------------------------------------------ > page: [BACKTEST]
def page_backtest():
p1.Backtest().backtest_1()
# ------------------------------------------------------------ > page: [FORECAST]
def page_forecast(today_stamp):
p1.Forecast(today_stamp).run_forecast()
# ------------------------------------------------------------ > page: [STRATEGY]
def page_strategy(today_stamp):
p1.Strategy(today_stamp).run_the_strats()
# ------------------------------------------------------------ > page: [ANALYSIS]
def page_analysis(today_stamp):
p1.Analysis(today_stamp).run_analysis()
# ------------------------------------------------------------ > page: [PORTFOLIO]
def page_portfolio(today_stamp):
p1.Portfolio(today_stamp).run_portfolio()
# ------------------------------------------------------------ > page: [RECOMMENDER]
def page_recommender(today_stamp):
p1.Recommender(today_stamp).run_recommender()
# ------------------------------------------------------------ > page: [TEST]
def page_test_env(today_stamp, edate):
p1.Test().run_test()
p1.Test_Env(edate).build_test()
# ------------------------------------------------------------ > page: [RUN]
today_stamp = str(datetime.now())[:10]
# today_stamp = '2021-10-07'
if page_login(today_stamp):
st.sidebar.title("__ · NAVIGATION · __")
st.sidebar.markdown(f"{'__'*25} \n {'__'*25} \n")
st.sidebar.caption(s0.navGuide_a)
st.sidebar.caption(f"{'__'*25} \n {'__'*25} ")
st.sidebar.caption(s0.navGuide_b)
st.sidebar.header("__[1] Select App Section__")
st.sidebar.caption("- __Navigate pages using the drop-down-box below__")
systemStage = st.sidebar.radio("", l0.general_pages, key="nunya")
st.sidebar.write(f"{'__'*25}\n {'__'*25}")
if systemStage == "Home":
page_home()
if systemStage == "Market Snapshot":
page_snapshot(today_stamp)
if systemStage == "Investment Advisor":
page_proof()
if systemStage == "Asset Backtesting":
page_backtest()
if systemStage == "Price Forecasting":
page_forecast(today_stamp)
if systemStage == "Modern Strategy":
page_strategy(today_stamp)
if systemStage == "Portfolio Analysis":
page_portfolio(today_stamp)
if systemStage == "Recommender Tool":
page_recommender(today_stamp)
if systemStage == "Traditional Analysis":
page_analysis(today_stamp)
if systemStage == "Huddle-Up":
huddle_up()
if systemStage == "test_env":
page_test_env()