Using nginx along with IIS - python

I am trying to deploy a Flask application I developed in an already existing IIS server. The problem is that the IIS version is 6 and is installed in a Windows 2003 server. I tried and failed deploying it onto the existing IIS server.
As a work-around, I have decided to use a Linux VM and deploy the application on uWSGI / nGinx server.
Now, since I have very little understanding of the way web servers work, I want to know if I would be able to deploy the flask application on nginx and link it with IIS? I don't even know if the question makes sense. But basically I just want the same URL that is now used to ping IIS also to ping nginx.
For ex. //TestServer/app1 is on IIS. So can //TestServer/app2 be called in from nginx?
Thanks.

Related

Deploying django(windows) with apache(on unix)

I know it might be a bad design but since we are developing the django website on our laptops which runs Win7, I thought it would be better to run django on a Windows platform only in production.
(Laptop is not powerful enough to run a Unix VM inside and our Unix team doesn't provide any Unix server with UI access (Only Putty) so using an IDE is impossible on Unix.)
I have deployed django with gunicorn and nginx on a Linux server very easily, but this time I have to deploy django on a Windows server with Apache on another Unix server (I know it sucks).
Our middleware team is asking(forcing) to run django components on a separate server so that they can manage their Apache (on Unix) instance comfortably. As far as I understand, Apache and django should reside on the same server for mod_wsgi to work.
Is this possible to keep Apache on a Unix machine and make a django website run from a Windows machine?
If not, what are the best possible solutions in my case? (Switch django on Unix? Use waitress on Django windows? Do not separate Apache and Django? etc.)
Regards,
Aditya
Try deploying on IIS instead, as it is the native Web Server on Windows Servers.
Checkout the django-windowsauth package, you can use it to deploy your project to IIS using few simple commands. https://github.com/danyi1212/django-windowsauth.
The best thing in my modest point of view is to create a unix docker image of your project

How to deploy python flask application on another windows 10?

I have develop python flask application(REST API). Now I want to deploy this application on client system(Windows 10 Professional ). My client dont have any internet service.
Previously, I done in java that time I make a .war file and deployed in tomcat on client system. He was able to access REST API.
Now I want know any similar way to deploy python app on client system, on start system his able to access my REST API
use PyInstaller.
pip install pyinstaller
go to project dir
cd C:\Users\sandip\Desktop\MyPython
use
pyinstaller --onefile HelloFlask.py
If you just want to make your rest APIs accessible by other users in same network, you can simply do it without installing anything on client side by replacing the app.run() in your code to app.run(host= '0.0.0.0'). By default flask app runs on localhost, by changing it to latter causes it to run on your machines IP address, thus making it accessible by all the users under same network. You can read more on flask's documentation under the heading Externally Visible Server.
To deploy your app in production, you need a WSGI server, you can read about deployment of flask app here

Hosting Django server on FTP space

I have built a Django project which I'd like to deploy now. I've already tried deploying it on pythonAnywhere which worked. But, my college wants to host it on their server and they have given me some server space and FTP credentials to upload files there. How can I get my Django website on to my college's server and host it from there?
Currently, most popular pattern is to use Nginx and Gunicorn. Gunicorn to run your Django app and Nginx to serve as a reverse proxy for Gunicorn. You need something like Gunicorn, a WSGI compatible application server to serve your Django app. Otherwise, I don't think that's possible.
Read more about how to deploy a Django app here: Deploy a Django app to Digital Ocean

Flask using Nginx?

I am a .net developer coming over to python. I have recently started using Flask and have some quick questions about serving files.
I noticed a lot of tutorials focused on nginix and flask. However, I am able to run flask without nginx. I'm just curious as to why this is used together (nginx and flask). Is nginx only for static files?
Nginx is a proxy server, imagine your apps have multiples microservices on differents languagues.
For more info NGINX REVERSE PROXY
On a development machine flask can be run without a webserver (nginx, apache etc) or an application container (eg uwsgi, gunicorn etc).
Things are different when you want to handle the load on a production server. For starters python is relatively very slow when it comes to serving static content where as apache / nginx do that very well.
When the application becomes big enough to be broken into multiple separate services or has to be horizontally scaled, the proxy server capabilities of nginx come in very handy.
In the architectures I build, nginx serves as the entry point where ssl is terminates and the rest of the application is behind a VPN and firewall.
Does this help?
From http://flask.pocoo.org/docs/1.0/deploying/ :
"While lightweight and easy to use, Flask’s built-in server is not suitable for production as it doesn’t scale well. Some of the options available for properly running Flask in production are documented here."

Deploy pyramid/pylons application on shared hosting

I have a locally developed Pylons application. I also have hosting provider with SSH access, python 2.6 and have set a virtual environment on the server. After that using easy_install I have installed Pylons and achieved to execute it on port XXXX. The problem is that the firewall of the server is blocking any port other from 80 (the port of the Apache http). Can I redirect Apache to forward to my Pylons server?
If you are in jail or virtual container where running your isolate instance of apache, just kill it.
You can see process list by execute 'top' utility.
You need to configure a virtualhost in apache so that it uses wsgi.
There's a plenty of topics in stackoverflow about this, such as
Trying to get Pyramid running under Apache + mod_wsgi but it's failing
(you can follow the link in the first sentence).
If you cannot use mod_wsgi, that you can try with mod_rewrite or mod_proxy, which have worse performance. If you cannot change the apache configuration, ask you provider, or start thinking about changing provider.

Categories