How I develop Django projects
blog.kristian.io
blog.kristian.io
But... after getting over that and putting some time into learning the program, I can highly recommend it for Django development. It is incredibly feature rich with a lot of Django-smart tools. Though I still love and use Vim, one instance of runtime debugging inside a problematic template using PyCharm made it a permanent tool for when I'm doing Django (and other Python) work.
I'm not saying using Fabric is a bad idea, just that about all it shares with Make is being a vaguely useful place to namespace a bunch of commands.
ohmyzsh has a virtualenvwrapper plugin that does it automatically when you cd into the directory of the same name as the virtualenv.
btw I don't get why you alias mkvirtualenv for venv, workon for work, don't you use tab autocompletion?
btw aliases are not zsh specific. basically, the only thing that you mention that is specific to zsh there is the ohmyzsh theme :)
There was a Django best practises book that has this stuff in it.
Also use Fabric instead of make, and have a separate project (installable as a Python module) that has your "common" Fabric commands for deployment stuff.
If you are on Linux, never ever ever do "sudo pip". Use your package manager for system packages.
Make is generally installed on most systems, therfore I prefer it over fabric - but the idea is the same.
I disagree about sudo pip on Linux, e.g. python-virtualenv wasn't updated for a long time in Ubuntu. Therefore, I still recommend getting the newest with pip. You coud apt-get python-pip, but most other things I would get from pip.
Heavily seconded. After many years of having separate files, this grew very unwieldy with multiple environments, machines, developers, etc. The env-variable route is much better, much easier to configure separately for different machines, etc.
Also, this is the way Heroku does it - you load up a new server and run several "set env variable to {X}" commands to configure it. I think this is based on the 12-factor app system. (http://www.12factor.net/)
Also, fun story: I've been working on both my MacBook and my Chromebook, and I've been deploying to Heroku. This resulted in me accidentally ending up with three versions of my settings.py. Always a pleasant sensation to runserver only to end up staring at a database error. Not at all terrifying.
I haven't run into any problems using it this way that many other people seem to have. Judging from online forums, many people install a chroot, Unity, and then everything falls apart for them because Dropbox/Sublime Text/something isn't ARM compatible. Sticking with just a browser and a CLI has made development on the Chromebook simple.
We use vagrant and salt stack to maintain a consistent development environment across developers as well as our production environment. It works very well, and gets new developers going in no time. I'll write a blog post about this on the Opbeat blog sometime.
I will be looking forward to your blog post. Considered Salt as well, but didn't get a chance to take a proper look yet. We use puppet for now, also with Vagrant.
I switched to PyCharm a month ago and am EXTREMELY happy with it. I have not touched Komodo since then. The ONLY things I miss from Komodo are syntax highlighting of $Everything (e.g. Makefiles, Bash scripts, Perl, etc) and the ability to easily open files from elsewhere (e.g. /tmp/foo.bar). Both are things that Jetbrains have said detracts from their focus of delivering an awesome __Python__ IDE -- and I grudgingly agree. PyCharm is more polished than I'd dreamed - so much so that this is the first time I've been willing to spend money on an editor in over a decade.
If you already have an existing project folder, you don't need to create a new Workspace or Project -- just open that folder.
Just to reiterate, this is coming from someone new to Django, not a power user.
That one covers virtualenvwrapper, too, on top of virtualenv, so you don't have to deal with that cruft in your project directory at all.
You run `virtualenv .` in your project folder and it will
setup a virtual environment. To enter the virtual
environment run `source bin/activate`. I don’t know about
you, but I hate to see bin/ lib/ and other folders in my
project directory, so I made a wrapper around virtualenv
in my ZSH scripts.
Why not just make the virtualenv elsewhere (I use ~/virtualenvs/)?Also, how about django-extensions? I don't know what I'd do without runserver_plus and shell_plus.
For me, pythonbrew + autoenv ( https://github.com/kennethreitz/autoenv ) is must for development.
If you are from ruby / rails world, you will love and be at home with pythonbrew.
Because of that, I've gone back to using homebrew to compile multiple versions of python and letting tox utilize those. Homebrew takes care of pip & distribute so adding virtualenv & virtualenvwrapper is a simple oneliner after the fact.
So I can just do workon myproject and be instantly transported to the right place with the right environment.
I think you meant 'sudo'
As for file structure, I thought Django came with a pre-built structure? I may be wrong, as I've only used Django for quick side projects and not really any extensive development.
Great post nonetheless!
Django comes with a structure, only slightly different.
I'm sure there's a page on djangoproject.com somewhere that talks about this but I can't find it right now.
[0]: https://docs.djangoproject.com/en/1.5/ref/django-admin/
Also for me, it was a timely recommendation of a branch of gitx - I just started using gitx yesterday, and this branch of it seems like it will be of great benefit.
Does anyone know other tools that make life easer for git users on OSX?
This is amazing. I only barely played around with it, but it's already answered a lot of my known (and unknown) desires - easy to see the whole tree (like gitx), easy to see what changes exist between any two revisions, easy to see what changes remain uncommited, easy to cherry-pick specific changes...
Seriously, this is an awesome tool.
Integrates well with github and bitbucket. It's what I recommend to designers to use for git.