For most required applications you can use PIP, MacPorts, Python sources, etc. As a result, you might end-up with a massive mess ! To avoid any issue, I’m using PIP & VirtualEnv so I can easily manage multiple Django projects. To do so, the easiest is to get started with Brew.
The libraries to install
A typical Django project requires:
- a specific version of Django - and it will regularly change
- many Django “plugins”
- either SASS or LESS
- PostgreSQL
- and GIT of course
To cover these requirements and more, we are going to install:
- F.lux (for your eyes & brain !)
- Brew (MacOs package manager)
- Git - via Brew (revision control)
- Python with PIP - via Brew (PIP is the python package manager)
- virtualenvwrapper - to make it easy to setup & use multiple projects
- LESS & SASS (CSS stuffs)
- PostgreSQL
- Pycharm - an awesome Python IDE
Even though you don’t necessarily need all of these applications / libraries right now, you’ll need them at some point.
F.lux - fixes blue light. This has nothing to do with Django but I consider this application to be a must have. It’s a really quick download & install.
“f.lux fixes this: it makes the color of your computer’s display adapt to the time of day, warm at night and like sunlight during the day.”
2.Brew - package manager
Open up your terminal (in the Finder it is under: Applications/Utilities/Terminal) and type:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then in ~/.profile
add the path that will be used by applications installed via brew:
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
3.Git - revision control
In your terminal:
brew install git
4.Python with PIP
In your terminal (this will take a couple of minutes):
brew install python
You can now try to type pip
in your terminal, it should work.
5.virtualenvwrapper
In your terminal (this will take a couple of minutes):
pip install virtualenvwrapper
mkdir -p ~/Envs
vi ~/.profile
In ~/.profile
add:
export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh
For more information, see VirtualenvWrapper official documentation .
6.LESS & SASS
In your terminal:
brew install npm
npm install less -global
sudo gem install sass
7.PostgreSQL
For Postgres, I find it easier to use PostgresApp. First download it and then add it to your path so Django can find it.
In ~/profile
add:
export PATH=$PATH:/Applications/PostgreSQL.app/Contents/Versions/9.4/bin
Your ~/.profile
should look like this:
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin`
8.PyCharm
PyCharm is a fantastic IDE. You can try the professional edition for a month for free.
Et voilà !
You can finally create a virtual environment and install Django. You can also use Git, Postgres, SASS & LESS.
mkvirtualenv myapp
pip install Django