Django For Mac



  1. Django For Machine Learning
  2. Python Django Install
  3. Django Machine Learning Projects

I’m writing this partially for myself so I have a reference for what’s wrong while trying to install Django in a Python virtual environment on OS X. I’m just going to write about errors I encountered I think.

  1. Download Mac OS X 64-bit/32-bit installer; Python 2.7.12 - June 25, 2016. Download Mac OS X 32-bit i386/PPC installer; Download Mac OS X 64-bit/32-bit installer; Python 3.4.4 - Dec. Download Mac OS X 32-bit i386/PPC installer; Download Mac OS X 64-bit/32-bit installer; Python 3.5.1 - Dec. Download Mac OS X 32-bit i386/PPC.
  2. In this tutorial part, we are going to see how to install Python and Django on the major available operating systems i.e Windows, Linux and MAC. At this point of our Django tutorial, we have covered what is Python, MVD and Django and the features of the Django.

Django For Machine Learning

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel.

In the directory where I wanted to put the virtual environment type:

where django-ve will be the virtual environment. It should exist first.

Activate it:

2
source bin/activate

Following Django’s own guide still use pip to install it:

But when I did this I got an error with the SSL connection to PyPy exactly as in, this Stack Overflow post. The solution was as they describe in the accepted answer though you also have to update pip both inside the new virtual environment and outside. (I first tried updating it, then recreating the virtual environment, but this didn’t help, which kind of makes sense if it fetches a new pip each time.)

Since I want to use a full MySQL database I needed to install the Python connectors. I stuck with the Django recommended way. I tried to follow their instructions.

When I tried to install mysqlclient I got this same error. Updating Wheels as per one of the suggestions didn’t help, but running

did fix the problem by installing the Apple provided developer command line tools which install a C compiler.

Download django for mac

I verified that the Python virtualenv could see Django as instructed and it could.

At this point, the setup guide ended so I’m just proceeding along with the tutorial.

I continued through the tutorial pretty well OK up until the part about configuring timezones. Silly me, I wrongly assumed I could modify it from ‘UTC’ to ‘AEST’, but even as is linked in their own guide, it’s based on the TZ Database so I should use ‘Australia/Queensland’

Django

Then proceeding along and running

Python Django Install

runs successfully and going back to MySQL Workbench I can see all the tables that Django created. Looking good so far.

Django Machine Learning Projects

By this stage I’ve set it up and worked connect it to a real database, so that’s enough for now. I may come back later and critically evaluate Django for my purposes.