Grovey
@echo off
@echo off
REM Set environment variable to suppress the welcome screen
set STREAMLIT_SERVER_HEADLESS=true
set STREAMLIT_BROWSER_GATHERUSAGESTATS=false
REM Change to the directory containing your Streamlit app
cd /d "C:\path\to\your\streamlit\app"
REM Run the Streamlit app using the specified Python executable
"C:\Python39\python.exe" -m streamlit run app.py
REM Close the command prompt window after execution
exit
REM Change to the directory containing your Streamlit app
cd /d "C:\path\to\your\streamlit\app"
REM Run the Streamlit app using the specified Python executable
"C:\Python39\python.exe" -m streamlit run app.py
REM Keep the command prompt open after execution
pause
Step 4: Configure the Service Using NSSM GUI
Path:
- In the
Application
tab, for thePath
field, browse to yourcmd.exe
executable, typically located atC:\Windows\System32\cmd.exe
.
- In the
Startup Directory:
- Set the
Startup directory
to the directory where your batch file is located, for example,C:\path\to\your\batchfile
.
- Set the
Arguments:
- In the
Arguments
field, enter:shell/c "C:\path\to\your\batchfile\run_streamlit.bat"
- In the
I/O Redirection (Optional):
- If you want to capture the output of the batch file, go to the
I/O
tab and specify files forOutput (stdout)
andError (stderr)
.
- If you want to capture the output of the batch file, go to the
Click Install Service:
- Click the
Install service
button.
Comments
Post a Comment