BookmarkSubscribeRSS Feed

360 Custom connectors: How to deploy a Python package as a Windows service on Production

Started ‎06-26-2025 by
Modified ‎06-26-2025 by
Views 1,092

Python package using Flask: What are the challenges?

 

Here we are considering a scenario where we have developed a custom connector logic using python technology and have used Flask as a development server.

 

It is ok to use flask in development environment to develop and test your connector. But as this was provided only for development, same time it has many disadvantages, like it is not designed to be particularly efficient, stable and secure.

For such reasons, we avoid direct use of python flask service for production environment.

Also, when we run python flask service it shows up a Warning message saying do not use this development server in a production environment.

 

 

ranjanasharma_0-1750923409419.png

 

So, the question comes that we have developed and tested the python package on development then how to deploy it on production without using WSGI server and which one to use?

 

Solution: WSGI Server for Production

 

The answer is to use production WSGI server instead of flask. These are Self-hosted as WSGI servers that has HTTP servers built in.

 

A WSGI server is used to run the application, converting incoming HTTP requests to the standard WSGI, and converting outgoing WSGI responses to HTTP responses.

There is a list of several Self hosted WSGI servers like Gunicorn, uWSGI, ASGI, gevent etc.

 

Waitress as WSGI Server

 

It is suggested to use Waitress, as it has many advantages like it is easy to configure, supports Windows as well as Linux, Secure and no dependencies, and once you installed waitress then you won’t need any other python library.

 

ranjanasharma_0-1750934933317.png

 

ranjanasharma_1-1750934943721.png

 

Now, let’s consider that we have developed and updated our python package using Waitress. The next challenge is, in the customer's Production environment, we need to deploy this package as a Windows Service.

 

NSSM: What it is?

 

It is recommended to use NSSM that stands for Non-Sucking Server Manager. This is a service helper that help run Flask application as a windows service.

 

ranjanasharma_2-1750934994133.png

 

 

There are many advantages in choosing NSSM for deploying Python package as Windows Service:

1. If the service stops because of unknown reason, then NSSM restart the service.

2. User can easily manage the service from Services.msc screen.

3. We can also use NSSM commands to run the application’s batch file as windows service.

4. The command line output can also be saved in log files as text.

 

NSSM to deploy Python package as a Windows service:

 

Now let's look at one of the examples of using NSSM commands for running python batch file as windows service.

Let’s assume we have server.py python file and we created its batch file named run_server.bat. Then we can use below given NSSM commands to run this batch file as background service on windows.

 

ranjanasharma_3-1750935565072.png

 

Once completed executing above commands, we could verify our service if it got deployed successfully from under Services.msc screen.

So, that’s how using NSSM one can deploy Python Flask application as a windows service on customer's environment.

 

 

Contributors
Version history
Last update:
‎06-26-2025 07:35 AM
Updated by:

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

Stay ahead of what's shaping modern marketing. Subscribe to the CMO Mandate for sharp perspectives on AI, strategy and what's next.

linkedin-400.pngFollow Customer Intelligence 360 on LinkedIn for insights, success stories, and practical tips to help you modernize your marketing stack.

Leader Spring 2026.png

Want to review SAS CI360? G2 is offering a gift card or charitable donation to One Tree Planted for each accepted review. Use this link to opt out of receiving anything of value for your review.

 

SAS Customer Intelligence 360

Get started with CI 360

Review CI 360 Release Notes

Open a Technical Support case

Suggest software enhancements

 

Training Resources

SAS Learning: Customer Intelligence​

Access free tutorials

Refer to documentation

Latest hot fixes

Compatibility notice re: SAS 9.4M8 (TS1M8) or later

Article Tags