I need to deploy a small Django app to be used in a small intranet. Concurrency and speed are non issues because there will be, at most, 10 users (and I bet that there will be almost no concurrency).
There is already a MySQL server. The problem is with the Django app. What is the most lightwieght server I can install under a WinXP environment ? The Apache + mod_python approach seems a little overkill. The cherrypy server seems more suitable.
Any suggestions ? Someone with similar experiences ?
You could use IIS with PyISAPIe.
I outline my Django on Windows deployment here and also more info on PyISAPIe with Python 2.6 here.
As I'm not a big fan of IIS, I'd still use Apache + mod_wsgi. mod_wsgi is officially recommended way of deploying django apps, according to http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/
We're currently deploying a small intranet Django app to complement a closed source app on IIS to an audience of about 300-400, but low use.
We opted for cherrypy by means of django-wsgiserver, but go for the bitbucket version if you don't use the admin, there's a bug in the 0.6.10 version that's on pypi.
We have IIS as a reverse proxy in front of it, and use media from the existing app. Don't know yet if it's stable, but I like the fact that it's conceptually the same as the Apache+gunicorn setup that I use on the *nix box.
Since this question dates from 2 years, I'm very curious about your experience.
The Windows port of lighttpd also bears mention.
Related
So far, the only websites I've put in a hosted domain were with PHP. But since I work with Django I wonder if there would be any "barrier" or trouble when it comes about hosting a project, since Linux and IOS have Python installed by default but Windows not. Also it would be necessary to install tools such as Django itself, pillow, mysqlclient, etc...
I just want to know any possible barrier before going ahead. Thanks!
Everything depends on the server, if you have the necessary permissions to install and configure everything, you will not have any problem. How can be gunicorn, supervisor, nginx, etc.
For example services that you will not have any problem can be Amazon EC2, digitalocean, or any similar provider.
When I started with Django about 4 years ago I didn't know anything about servers, nginx and very little about databases but I found Djangoeurope on which I put my first websites.
They have managed databases (PostgreSQL and MySQL), one-click Django installs, reasonable prices and a very helpful staff.
I've since transitioned to using Docker on GCP, but for a beginner I can't recommend them enough: you can just concentrate on your Django code and you don't have to learn everything else at the same time.
I have a Django web application which should be easy to install on Linux systems. The app does not need much performance. It is just a simple web GUI for some services. So a full-blown deployment with Apache is not needed. I am looking for a lightweight web server that has little or no configuration; just like the Django development server.
It should be possible to run it as daemon, though.
Any suggestions?
You can use Quick and dirty multi-threaded Django dev server.
But, configuring apache or fastcgi to server django applications is not a hard thing, so you should really do that.
I would use Green Unicorn with nginx, very light weight and fast. It does has some configuration unfortunately, so it might not be ideal for you, but worth checking out.
http://gunicorn.org
http://wiki.nginx.org/
Here is a blog post that explains how to set it up with supervisord.
http://kencochrane.net/blog/2011/06/django-gunicorn-nginx-supervisord-fabric-centos55/
I run a small VPS with 512M memory of memory that currently hosts 3 very low traffic PHP sites and a personal email account.
I have been teaching myself Django over the last few weeks and am starting to think about deploying a project.
There seem to be a very large number of methods for deploying a Django site. Given the limited resources I have available, what would be the most appropriate option?
Will the VPS be suitable to host both python and PHP sites or would it be worth getting a separate server?
Any advice appreciated.
Thanks.
There aren't really a great number of ways to do it. In fact, there's the recommended way - via Apache/mod_wsgi - and all the other ways. The recommended way is fully documented here.
For a low-traffic site, you should have no trouble fitting it in your 512MB VPS along with your PHP sites.
Django has documentation describing possible server arrangements. For light weight, yet very robust set up, I'd recommend Nginx setup. It's much lighter than Apache.
I run several low-traffic Django sites on a 256 VPS without problem. I have Nginx setup as a reverse proxy and to serve static files (javascript, CSS, images) and Apache using mod_wsgi for serving Django as described in the documentation.
Running PHP sites as well may add a little overhead, but, if you're talking about low-traffic "fun" sites then you should be fine.
I'm going to setup a simple Django app running in a production environment on a Linux box. The app will have very little traffic - less that 100 page loads per day. Is it okay to use the builtin Django webserver for this or should I install Apache and mod_wsgi? If so, what are the reasons for this? Security perhaps?
UPDATE
OK it is clear I shouldn't be using the builtin server. Some of the alternatives to Apache look interesting. Is there one that is more popular/more frequently used with Django perhaps?
Is it okay to use the builtin Django webserver for this
No.
Should I install Apache and mod_wsgi?
Yes.
If so, what are the reasons for this? Security perhaps?
Partly.
More importantly, the little toy Django server is single-threaded and any hangup in your code hangs the server. This means that when two users click almost at the same time, user one's query must go all the way through Django before user two's query can even starts.
And this will have to include the insanely slow download speed to the desktop.
Apache (like all the alternatives, lighttpd or nginx) is multi-threaded. The slowest part of the transaction is the download from Apache to the desktop. You don't want Python code (and Django) handling this in a single-threaded manner. Even for just a few users.
Also, you don't what Django serving static media (i.e., CSS and JS library files.)
A single slow spot in your application won't effect the overall system throughput if Apache and mod_wsgi are in place. One request 's output page can be slowly downloading to a PC desktop in parallel with another user's output.
DO NOT USE THIS (the builtin Django webserver) SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests.
http://docs.djangoproject.com/en/dev/ref/django-admin/#runserver-port-or-address-port
But you don't have use Apache if you don't want to. You could directly use Spawning, Gunicorn etc.
Cherokee is also easy to setup.
Use nginx + gunicorn.
Nginx: five lines of configuration. Gunicorn: two lines of configuration. That's easy and efficient. For better control you can spawn the gunicorn process using supervisord.
Both gunicorn and supervisord are available to install with pip, and nginx is available in almost any distribution in the default package pool.
The built in Django server was not built for production. There are many reasons why, mainly security and efficiency.
The recommended way is to use mod_wsgi which is covered in the docs here
I am about to choose hosting provider for my Django project. I took a look on a linode
and it looks very promissing. It looks like very elastic solution but in my case this might be a disadvnatage since I'm not so experienced in servers configuration (alternative provider for me has great tools to quickly do the job, but linode has more competitive power/price ratio).
Do you have some experience in linode configuration for Django projects?
EDIT:
To be more precise: I am not so affraid about django packages installation but more about application server/database server/security/all that stuff configuration.
Whether you stick to the Django packages that your distribution provides (Ubuntu seems to be best) or use easy_install, Django is pretty easy to get going. The host that you're looking at, Linode, has Django setup guides for a variety of distributions. I recommend mod_wsgi with Ubuntu 10.04 from that list.
I've personally used Django on my Linode, and it works fine. Well, in fact. For your intents and purposes you can think of a Linode as a dedicated server, and it will behave entirely the same for Django.