r/FastAPI • u/gymbez • Mar 27 '25
Hosting and deployment Fastapi on Windows issue. World I move to Linux?
Hi, We've created our first python fastAPI. I'm relatively newer to python (less than 1 year) and come from a data background.
We have a Windows environment and I have no experience with Linux. Because of that we decided to put our API on a Windows machine using unicorn through IIS.
The API works however it isn't stable. It's doing very simple queries that take less than a second yet it's sometimes takes 30 seconds to return the data. There are times when it times out and there are also times when the whole API is inaccessible and I have to restart IIS to get it going again. I saw that gunicorn is recommended for production but it isn't available for Windows so we've been using unicorn. Additionally we are in AWS so we could spin up a server relatively easily.
So my questions are...
- Does anyone have any experience utilizing fast API with unicorn and production on a Windows machine? Any ideas or suggestions?
- For someone with no experience with Linux how difficult would it be to deploy in Linux and maintain? What would be recommended to learn and is it too steep of learning curve to get up with 20 hours of trying to learn.
19
u/ePaint Mar 27 '25
Use docker
8
u/Friendly-Gur-3289 Mar 27 '25
Maybe try WSL once. If the issue persists, you can then consider moving to linux completely
3
u/djillian1 Mar 27 '25
IlS is a living nightmare. Best way if you want to use the windows machine is to containerized the app.
2
u/begemoto Mar 27 '25
It's always good to move to Linux
1
u/captain915 Mar 27 '25
are you deploying to the cloud? if so, there’s no reason to not use a linux server. you can still develop on windows locally
1
u/Salgurson Mar 27 '25
I also started few weeks ago and I had same issues. My solution was running app in venv. When I'm running on normal cmd I had same issue and also program conflict. Check that also.
1
u/Individual-Ad-6634 Mar 27 '25
I feel like the issue is not the framework but a proxy that is not configured correctly (IIS).
I suggest using minimal Python Docker image based on Ubuntu or Debian (to maximize compatibility and ease of debugging for a beginner).
Push image into docker container registry and deploy from there.
1
u/lynob Mar 27 '25 edited Mar 27 '25
I bet you that Windows has nothing to do with this issue, the issue could be one of the following
1
u/Mundane-Apricot6981 Mar 27 '25
If you would use Windows server (which costs money) it will be exactly same stable as Linux, but you probably tried to run server app on Windows 10/11 ? Just use Docker as all normal sane people do on Earth.
1
u/aviation_expert Mar 27 '25
I use docker to run gunicorn, hell even greenlets. When you make a docker image of your code, then you can use the gunicorn worker class and run docker on windows to check responses of ur API
1
u/InvictuS_py Mar 27 '25
Go ahead and use Docker like others have suggested. If you are unfamiliar with Docker and don’t have the bandwidth to learn it, you can look at running a VM.
1
u/jeyhuno Mar 28 '25
Fuck adobe, if not them i would move to Linux 20 years ago
1
u/tocortes Mar 28 '25
i did a big part of university using WLS2, it will always work, but i got tired of especial configurations and hours of trial and error for something just a notch above simple.
I like linux (and now macos) because everything around development just works.
1
u/Fit-Atmosphere-1500 Mar 29 '25
Docker with ngrok
-5
u/Jugurtha-Green Mar 27 '25
You better move to Linux if you can yourself A DEVELOPER