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.
Related
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
I have an application setup in Flask and running on localhost in a Windows environment. All of the tutorials I have read said to not use the default Flask server in production.
The production servers Gunicorn and uWSGI both only work in Unix. Is there a way to run either one of those through Windows?
Or do I need to switch the project over to a UNIX development environment?
There's many WSGI servers you can use to serve a Flask application. If you really need to deploy it to Windows, then I did find NWSGI, which might be worth a look.
I think it's fair to say that WSGI servers are few and far between on Windows, as this list only mentioned NWSGI. Unless you have a very good reason to deploy to Windows, I think you're probably better off opting for a *nix environment.
Even with this question answered I wanted to add that you can run wsgi apps on IIS
which is a production level web server.
the easiest example is how flask can run on azure (IIS) but I saw a link explaining it even better https://heejune.me/2015/04/22/running-python-flask-on-a-local-iis-not-azure-with-wfastcgi-py/
Waitress is a pure python solution for both Windows and Nix platforms that is no more complex to set up than the development server.
We have an application written in django. We are trying a deployment scenario which will have one docker running apache, the second docker running django and the third docker running the DB server. In most of the documentation it is mentioned that apache and django will sit on the same machine (django in virtualenv to be precise), is there any way we can ask apache to talk to mod_wsgi sitting on a remote machine which has the django application?
mod_wsgi would be the wrong technology if you want to do this. It runs as part of Apache itself, so there literally is nothing to run in the Django container.
A better way would be to use gunicorn to run Django in one container, and have the other running the webserver as a proxy - you could use Apache for this, although it's more common to use nginx.
I'm new to linux development. I'm a bit confused on the documentation i read.
My ultimate goal is to host a simple python backed web service that would examine an incoming payload, and forward it to other server. This should be less than 30 lines of code in python.
I'm planning to use nginx to serve up python file. From my research, i also need a python web framework. I chose to go with uwsgi. I'm so confused. which one do I need? an nginx uwsgi module, or uwsgi server? i don't want to put django just for this simple purpose.
the nginx documentation mention that
Do not confuse the uwsgi protocol with the uWSGI server (that speaks the uwsgi protocol)
So, does that mean, i don't need to install uwsgi server separately? do i just install nginx, and start configuring? I'm using nginx 1.4.4
Could someone share a step by step configuration procedure on how to configure uwsgi with nginx, along with a sample python code(hello world maybe)? i can configure nginx just fine, but i don't know how to make it serve python pages. all the docs i could find involves having django on top.
You're mixing up things, so let me clarify.
Python's standard way of publishing applications via web servers is WSGI--you can think of it as a Python's native CGI. uWSGI is a WSGI-compliant server that uses uwsgi protocol to talk to other uWSGI instances or upstream servers. Usually the upstream server is nginx with HttpUwsgiModule that allows it to communicate using uwsgi protocol--with nginx you have additional layer of protection for your app server, load balancing and serving the static files. In most scenarios, You Should Be Using Nginx + UWSGI. To answer your question, uWSGI is installed and run separately from nginx, and they both need to be configured to communicate to each other.
Pure WSGI is pretty low-level, so you may want to use a WSGI-compliant framework. I guess the top two are Django and Flask.
For a hello world Flask setup, Serving Flask With Nginx seems to be a good article.
I currently have Apache setup on my VPS and I'm wondering what would be the best way to handle Pylons development.
I have the directory structure with public_html in my home directory which includes separate website directories to which I map the IP to the DNS provided by my name registrar.
Is there a way to get paster running within a new directory (i.e. make an env/bin/paster) and run it to that?
If so then do I even need to get a new IP? Or would I be able to run both webservers in parallel on the same server without experiencing any conflicts?
I'm looking to convert all my new projects to Pylons.
It's usually more practical to develop first your application locally using pserve, the builtin HTTP server in Pyramid (it used to be paster before Pyramid 1.3 but pserve behaves similarly). This HTTP server comes quite handy when developing for debugging, but you don't usually expose your web application publicly with this server.
Once your application is ready to go public you should deploy your application on your server with another HTTP server like Apache. You can use WSGIScriptAlias if you have Apache with mod_wsgi, as it's documented in Pyramid, to map a subdirectory.
The official documentation explains also explains how you can have different subdirectories running different Pyramid instances with a virtual root.
If you really want to make your application accessible publicly with pserve, you can still use the urlmap composite functionality of PasteDeploy as explained in the documentation.
If your DNS are properly configured you don't need to mess with the IP.