RSS Feed
  1. Basic Django setup with VirtualEnv and Pip

    August 13, 2011 by Helmut

    For a while I struggled to get an ideal setup procedure for new Django projects. On an Ubuntu-based system, this is the process I now follow for each new Django project (I assume MySQL is already installed):

    • 1. Change to your project’s directory
    • 2. Install VirtualEnv
    sudo easy_install -U virtualenv
    • 3. Initialize the virtual environment for your project (substitute your own directory for “ve” if you want)
    virtualenv --no-site-packages ve/
    • 4. Activate the virtual environment
    source ve/bin/activate
    • 5. Install Pip (UPDATE: this is only required if you want to update to the latest version, since Pip is included with VirtualEnv)
    easy_install -U pip
    • 6. Install Django
    pip install Django
    • 7. Install MySQL bindings for python
    pip install MySQL-python
    sudo apt-get install libmysqlclient-dev
    • 8. Install Django-South, if you use it
    pip install south
    • 9. Create your Django project, application, etc.

    I’ve tried different approaches (including Vagrant), but I like this method because it is very simple. How do you go about a new Django setup? Anything that can be improved?

    UPDATE: Thanks to Doug Warren for some pointers on what to improve. Further changes coming soon.


  2. Multiple Apache websites on Ubuntu

    August 8, 2011 by Helmut

    To set up multiple local websites on Apache, follow this process.

    • 1. Install Apache 2 via synaptic or apt-get (package: apache2).
    • 2. Create the following folders (change the location to your liking) and copy your website files to the “root” folder:
    /home/user/www/website1/
    /home/user/www/website1/root/
    /home/user/www/website1/logs/
    • 3. Create new site configuration file (e.g. “website1″) in /etc/apache2/sites-available/ with the following contents:
    <VirtualHost *:80>
        ServerAdmin website1@localhost
        ServerName website1.dev
        DocumentRoot "/home/user/www/website1/root/"
        ErrorLog /home/user/www/website1/logs/error.log
        CustomLog /home/user/www/website1/logs/access.log combined
    </VirtualHost>
    • 4. Add the following line to your /etc/hosts file:
    127.0.0.1    website1.dev
    • 5. Set permissions so that Apache can access the website by running the following on the command line:
    sudo chgrp -R www-data /home/user/www/website1/
    sudo chmod -R g+w /home/user/www/website1/
    • 6. Enable the new website by running the following on the command line:
    sudo a2ensite website1
    • 7. Restart Apache by running the following on the command line:
    sudo /etc/init.d/apache2 restart
    • 8. Now visit http://website1.dev in your browser to see the website.

  3. Resources to help you become a Django pro

    August 23, 2010 by Helmut

    django logoI’ve been leanring Django in my spare time, and have collected some helpful resources along the way. Here are the most useful ones:

    Code

    • Official Django Documentation: This is where it all starts. Here you will find all the awesome features Django offers. Sometimes the code examples could be slightly better, but we can go to other places for that.
    • Official Python Documentation: If you don’t know Python yet, you will need to learn it too, since Django is based on Python. But don’t worry, Python is awesome! (link thanks to Dougal Matthews)
    • Django Snippets: If you need a solution for a specific problem, odds are someone has posted a code snippet for exactly that scenario.
    • Django Packages: Apps and tools for your Django website (thanks to Kyl1 for the link)
    • South: Django migrations made easy
    • Pinax: A collection of Django apps that extend Django to provide you with virtually any functionality you need.
    • StackOverflow: This site isn’t Django-specific, but if you have an issue in Django that you can’t solve, there are some very friendly Django coders who will try to help you.

    Blogs

    Books

    Inspiration

    Just for fun

    Well, that’s it. I hope these sites help you become a Django pro quickly. Enjoy!

    django pony


  4. Welcome

    August 14, 2010 by Helmut

    Welcome to the new DevignInnovation website. This space will serve as a launchpad for my explorations into programming, the web, and linux. In future you will find articles, downloads, and more.

    Hope to see you back here soon.