Hello, first of all, these are my first steps with Django, and i only have limited experience with Python, so please be patient.
I'm using it for what is intended to be a browser game in the future. The main part of the game is a zoom view on a two-dimensional map of fields. I'm currently using Django 1.2.3 with Python 2.6 on Windows XP. I'm using Python-provided SQLite and Django's local debug HTTP server during development ('python manage.py runserver'). It works pretty well, but i notice that it takes several seconds to update the map screen, which i consider unacceptable given the fact that it runs locally. I'm wondering where the performance bottleneck lies here. Is it... - SQLLite? (I.e. would switching to say PostgreSQL speed things up considerably?) - Djangos debug web server? (I.e. would switching to apache speed things up considerably?) - or the way my application is designed?? Since the latter is a very probable answer, here is the way it works in a nutshell: The model is something like: -------------------- class Terrain(models.Model): image_file = models.CharField(max_length=80) class Location(models.Model): x = models.IntegerField() y = models.IntegerField() terrain = models.ForeignKey(Terrain) The heart of the view goes like this: -------------------- center_location = Location.objects.get(id=location_id) ## how many fields on the map view in each direction half_x = 6 half_y = 6 locations = Location.objects.filter( \ x__gte=center_location.x-half_x, \ x__lte=center_location.x+half_x, \ y__gte=center_location.y-half_y, \ y__lte=center_location.y+half_y) locs = [] for l in locations: loc_info = {'id': l.id, \ 'x': l.x - center_location.x + half_x, \ 'y': l.y - center_location.y + half_y, \ 'img': l.terrain.image_file} locs.append(loc_info) c = Context({ 'locs': locs, }) return HttpResponse(t.render(c)) And the main part of the template renders these items: -------------------- {% for l in locs %} <div id="x{{l.x}}y{{l.y}}" class="tile"><a href="/map/{{l.id}}/"><img src="/images/{{l.img}}" /></a></div> {% endfor %} Do you see any issues with this approach? Any paths to performance improvements? Since i'm at the beginning of this project i would like to avoid going the wrong way. best regards, Lars -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.