Peter's Blog

Redefining the Impossible

Django development


On a sudden whim I decided to try developing my new django blog on my windows laptop then uploading it to the server when it is working. The setup is slightly complex and I have only just set it up so lets try to describe it in detail.

  • I already had the source in subversion so I installed tortoise svn a nice Windows svn client so I could access the source from windows, upload it into subversion when it was tested and read it back into the working image on the server.
  • Also using Tortoise I extracted the latest django source onto the laptop.
  • I set up the windows environment variables according to the django installation instructions.
  • Because my templates directories are different under windows and ubuntu I put a conditional section in my settings module:
       1  import os
       2  
       3  if os.name != 'nt':
       4      TEMPLATE_DIRS = (
       5          # Put strings here, like "/home/html/django_templates".
       6          '/usr/local/lib/Django/django_templates',
       7      )
       8  else:
       9      TEMPLATE_DIRS = (
      10          # Put strings here, like "/home/html/django_templates".
      11          'c:\\python24\\lib\\site-packages\\Django\\django_templates',
      12      )
    
  • I installed the mysql client on the laptop, along with the appropriate version of MySQLdb
  • I didn't want to run the database server on my laptop so I use an ssh tunnel to connect to the server: I have to run this in a command console while I am accessing the database:
    ssh -L 3306:127.0.0.1:3306 me@myserver.org
    
    For security the mysql server does not accept connections from outside the box it is running on, except via ssh. I am using the live database on the server and for development. I could create another instance of the database for testing.
  • To get to files needed by the theme (e.g. style.css) I had to tweek my templates under windows such that they were loaded from the server using the full absolute url rather than a relative url. I didn't want to make django server them or put apache on my laptop.
  • django_admin.py just worked, no problems.

Why did I do all this? Well I'm thinking again of using komodo as a development environment with a proper debugger. I don't have a lot of time to devote to all this, every minute is precious, so it will help to have productive tools available.


Filed under: django komodo python

Peter Says:

over 3 years ago

So far I have totally failed to be able to set a breakpoint in a view file using komodo, probably because it is dynamically loaded, I can't be sure without going through the django code. The Komodo release notes say it cannot set breakpoints in exec or eval statements.

I tried using the komodo remote debugger in case the explicit call to dbpg would do the trick but no joy.

I tried my vim python debugger and that worked fine. Moral: use free tools?

Peter

Have Your Say

I welcome constructive comments or questions but I reserve the right to delete any comments that displease me.

Who are you?

(Optional) If you enter an email address here I might email you back. Your email address will not be sold to spammers or shown anywhere

What do you have to say?