RSS

Category Archives: python

How I get a Token from the Rackspace Open Cloud from the Command Line

On Mac OS X

 
Leave a comment

Posted by on August 17, 2012 in curl, openstack, python, rackspace

 

Total Bottom Time

Hi Everyone,

I’ve updated my totalbottomtime.com website (total bottom time is the amount of time a diver has spent at depth). The vision for it is to be an online dive community where scuba divers from around the world can log their dives and share them with family, friends and other divers. For now I’m the only member of the “community” and so it’s serving as my personal dive log. I plan to continue adding features to it and eventually hope to open it for registration to the public.

In the meantime I thought it would be good to get a few eyeballs on it if you’d like to have a look. You can find a list of the dives I’ve recorded so far at totalbottomtime.com/blog/everett/. My latest are from a trip to Australia. If you notice anything that doesn’t work (e.g. a link doesn’t take you to the right place) or if a web page looks weird in your browser please send me an email and let me know.

If you’re interested in following my dive log you can subscribe to it via email or RSS. To do so click on one of my dives from the site. On the right hand side you’ll notice a profile box that looks like the one below.

To subscribe via email click on the mail icon that I’ve circled in red on the left. You’ll be taken to another web page where you fill in your email and a verification question. You’ll then get an email to where you need to click on a link to confirm your subscription. After that you’ll receive an email every time I add to my dive log.
If you know what RSS is and you’re comfortable subscribing to feeds then click the orange icon on the right.

Everett Toews

 
 

Install a full development environment for Django on Windows

I recently installed a full development environment for Django on Windows 7 and found that it took longer than expected. The path to getting everything working together wasn’t immediately apparent. I made a few missteps along the way and hopefully this post will make it a bit easier for the next developer.

The tools that I installed are:

  1. Python 2.7
  2. pip 0.8.2
  3. Postgres 9.0
  4. Django 1.3 Beta 1
  5. Intellij IDEA 10

Python

Just go to the Python download page and pick the version for you. I installed Python to C:\dev\tools\python27. Then I added C:\dev\tools\python27\Scripts and C:\dev\tools\python27 to my system PATH environment variable.

pip

To me it appears as though packaging in Python is in a painful disarray/flux. As far as I can tell pip is the way to go for Python 2.x. After reading What’s the proper way to install pip, virtualenv, and distribute for Python? I did the following to get pip installed.

  1. Download
    http://python-distribute.org/distribute_setup.py
    to C:\dev\temp
  2. Ran command: cd C:\dev\temp
  3. Ran command: python distribute_setup.py
  4. Ran command: easy_install pip

Now that pip is installed we can:

  1. Install packages: pip install SomePackage
  2. Uninstall packages: pip uninstall SomePackage
  3. Upgrade packages: pip install –upgrade SomePackage

Plus a whole lot more. For me, the above is already enough to choose pip over easy_install.

Postgres

Go to the Postgres download page and install it.

Now you’ll need a python-postgres database interface library. For this we’ll use psycopg. Go to the win-psycopg download page and pick the version that most closely matches your Windows/Python/Postgres versions.

Note that when you start a Django project you’ll want to use django.db.backends.postgresql_psycopg2 for your database ENGINE value in your settings.py.

Django

I wanted to take the latest beta release of Django for a spin so I didn’t install it via pip. However, when Django 1.3 is released on January 31, 2011 I’ll definitely be installing it with pip. Instead I more or less followed the Quick install guide for Installing an official release:

  1. Went to the Django download page and grabbed the latest tar.gz
  2. Extracted it to C:\dev\temp with 7-Zip
  3. Ran command: cd C:\dev\temp\Django-NNN
  4. Ran command: python setup.py install

After that’s done you’ll want to verify your install and try the tutorial.

While going through the tutorial I found that django-admin.py startproject mysite [was] not working well on windows 7. That’s already been reported to the django project, see
http://bugs.python.org/issue7936
. Here’s a solution:

  1. Open regedit
  2. Find python.exe (for instance, under HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command)
  3. Change “C:\dev\tools\python27\python.exe” “%1″ to “C:\dev\tools\python27\python.exe” “%1″ %*

I also stumbled onto a bug in Django on Windows, Cannot load admin interface static files when doing tutorial. Painful but something that should be fixed in the next beta release.

Intellij IDEA

Intellij IDEA has great support for Python and Django development. If you’re strictly doing Python development you could just download PyCharm. However, I already had IDEA 10 already installed so I just added the Python plugin (essentially PyCharm) from File > Settings > Plugins.

To get IDEA working with an existing Django project (for instance, the Django tutorial) you have to jump through a few hoops. I followed the instructions from Using Intellij for Django Development.

Conclusion

It’s a lot to do and a lot to configure but in the end it’s worth it. Python/Django development is fast, effective and the end result can be some easily maintainable code.

 
 

LinkedIn Profile

I finally got around to updating my profile on LinkedIn. If you are interested in retaining my services as a Java/Python Software Developer and Senior IT Consultant please see
http://www.linkedin.com/in/EverettToews
.

 
Leave a comment

Posted by on July 26, 2009 in java, linkedin, python

 
 
Follow

Get every new post delivered to your Inbox.