Having worked on many python/Django projects over the last few years I have come to be very familiar with virtual environments as the easiest way for me to manage multiple project requirements on just one machine. Without them my main python packages folder would be constantly fighting over different versions of Django, PIL and every other library under the sun.
Virtual environments are one of the best ways to create multiple unique development environments on one machine as they keep each projects packages contained with the specific versions required all in one folder.
Once you have multiple virtual environments it starts to get a bit complicated, especially if you have to switch between multiple ones in a day. This is where virtualenvwrapper becomes so useful. virtualenvwrapper adds an extra management layer on top of the virtualenv so that you can navigate to and start the environments with a single command. It also helps to organise your environments by keeping them in one location (previously I kept environments next to the project)
I’m not ...
Have you ever been on a website when something goes wrong? It’s not always clear what’s gone on, or what you can do to get back on track. What’s a 404 or a 500?! You might know this as a developer or web designer, but does the average Joe?
As the owner of a website you want to know what went wrong when or if it does and that’s why error numbers were created. But we build websites for users and not developers (except sites like this…), so the error numbers aren’t the key message that needs to be shown.
When a user visits a web page the most important thing is to give them the information that they need quickly and presented in a good way. The problem with a lot of error pages is that they treat users like robots and not as humans.
Imagine you go into a hotel where you have a room ...
A local settings file is one that is never controlled by version control and only contains settings relevant to the server – local, development or live. Often the local settings file is created by an example settings file that has all the relevant settings ready to fill in. The example settings are always committed to version control so that each developer who works on a project can see what they need to fill in when they clone the project.
One other major advantage of not adding the local settings for a project is that it keeps server settings safer because only people with access to the server can see them, unlike a project repo where even if it’s private, any developer with access can see it, and if it’s an open source project then everyone can!
OS X can be an absolute pain to get MySQL running so when you have finally resorted to using brew to install its, as I have on many occasion there is another pitfall you might face when you try to install other python packages that need to know the MySQL path.
The best and probably most common package that this happens to seems to be MySQL-Python so the following example will be what I use to demo the fix.
Assuming your virtualenv is up and running (or your installing straight on your machine) we need to do the following:
export PATH=$PATH:/usr/local/mysql/bin pip install MySQL-Python
MySQL-Python (or your other MySQL needing package) should now install and you can get back to coding up some awesome websites.
Recently I have been working on quite a few projects that require different versions of packages to run. Each setup has been running in a virtual environment (that is a post for another day) and setting them up with the required package rather than the latest that easy_install can find is really simple.
easy_install "django == 1.3"
That will find and install Django version 1.3... simple as that!
When setting up a new mac or fresh install of Mac OS X there is a issue that many developers may come across. The issue is with getting MySQL-python to work properly. This guide was written with 10.6.8 in mind, but it will probably work for earlier versions of the OS as well as (hopefully) 10.7 a.k.a.Lion.
EDIT: This will get you up and working, but for some reason it needs you to type the following into terminal before you start each time:
After you have typed this it will work until you next quit/restart. I will update this when I have figured out the best way of adding this into your paths so that you don't have to do it each time. If you know then feel free to comment below. Thanks.
The way to get this to work is a good clean install. You can google for how to remove older versions of MySQL , and I wouldn't remove ...