viper
viper

Reputation: 2210

Django website loads slowely, hosted on apache, using mod_wsgi, any way to make it faster?

I have set up a django website on apache on a AWS micro instance. I had a static webpage designed using Twitters bootstrap hosted on /var/www of apache. When I ported that page to django, I find that apache takes longer to serve that page. I am making use of mod_wsgi to host the application and using apache to serve the static files(css, images, etc.). Is there any other way to make the website load faster, or is there any other server that is better suited for Django web applications?

Upvotes: 0

Views: 559

Answers (2)

Mark Costello
Mark Costello

Reputation: 4394

Generally, anything that requires code to be executed/interpreted is going to be slower than a completely static page.

Some things to think about:

  • Do you have a database backend to this page? If so, you should make sure everything is indexed correctly.

  • Is there a lot of python code being executed? Are you doing anything that could be optimised?

If you're just rendering the template it is still going to be expensive, since the template has to be run through the Django rendering engine. My advice would be to cache any static assets that you can. A library like this might help: https://github.com/peterbe/django-static

Upvotes: 2

Matt Seymour
Matt Seymour

Reputation: 9395

I answered something similar to this recently check out this stack over flow link

finding out why a webapp is slow when hosted

Upvotes: 0

Related Questions