production setup documentation?

8 views
Skip to first unread message

Hervé Cauwelier

unread,
Jan 23, 2011, 11:20:11 AM1/23/11
to djang...@googlegroups.com
Hi,

I couldn't find any documentation/checklist about how to set up an LFC
site for production use and obtain most of the speed you claim.

My checklist, built buy try/error, looks like this:

* Changing the secret key in settings.py.
* fastcgi vs. gunicorn (gunicorn seems twice as fast and is way easier
to use).
* caching (memcached, database caching...).
* Optimizing serving static content.
* Nginx-specific tips.

Please keep in mind that it's my first Django project, so some things
may be obvious and some Django references may apply to LFC too.

Now I'm trying to debug a strange error. I want static content not to be
downloaded every time by sending 304 Not Modified instead. Using Firebug
I can see it's behaving like this when I refresh the page but not when I
go to another page. Yet the "Last-Modified" header is present in the
response. But Firefox won't send the "If-Modified-Since" request header.

And even more strange, with an HTTP 200 it replies in 30 ms but with an
304 Not Modified it replies in 200 ms. One would expect the opposite.

Maybe it's just a bug in Firebug.

Anyway, what are your reference documentations and settings for
production environments, and do you use optimizations or tips specific
to LFC?

Thanks,

Herv�

Pigletto

unread,
Jan 24, 2011, 3:29:35 PM1/24/11
to django-lfc
> I couldn't find any documentation/checklist about how to set up an LFC
> site for production use and obtain most of the speed you claim.
I think it is because there is nothing special about LFC and
everything that applies to another django project applies to LFC too.

> My checklist, built buy try/error, looks like this:
>
> * Changing the secret key in settings.py.
> * fastcgi vs. gunicorn (gunicorn seems twice as fast and is way easier
> to use).
> * caching (memcached, database caching...).
> * Optimizing serving static content.
> * Nginx-specific tips.
Server:
In general using gunicorn and nginx is good idea and I think its more
than enough for most typical use cases.

Some will prefer uWsgi instead of Gunicorn, as it is said to be
faster.

Nginx is very good but Cherokee might be easier to setup as it
provides nice graphical admin panel and out of box integration with
uWsgi.
Cherokee is also fast (see benchmarks at http://www.cherokee-project.com/)
but it is not so popular and battle tested as nginx.

My choice for next setup of my applications is: ngnix + wsgi.

Caching:
I use memcached, and I think it is a good choice.

Static files:
These should be served directly by web server, eg. nginx or cherooke.
You should set proper cache headers for them to avoid any unnecessary
requests.

One caveat is that LFC uses tinymce, so your media should be serverd
from same domain as your application, eg. mydomain.com/media/ because
using: static.mydomain.com will cause some Same Origin Policy errors
for javascript files.

> And even more strange, with an HTTP 200 it replies in 30 ms but with an
> 304 Not Modified it replies in 200 ms. One would expect the opposite.
>
> Maybe it's just a bug in Firebug.
What server is serving your media? Maybe you're still in Debug mode?
Set proper cache headers for static media.


> Anyway, what are your reference documentations and settings for
> production environments, and do you use optimizations or tips specific
> to LFC?
Currently I use Apache + mod_wsgi with memcached. I don't have any
optimizations special for LFC

--
Maciej Wisniowski
http://natcam.pl
Reply all
Reply to author
Forward
0 new messages