Prepare Django development environment using homebrew on MacOSX Mavericks (10.9)

Suffering from Import Error

Install python with homebrew and install django with pip. But it fails when the server starts.

$ python manage.py runserver

ImportError: No module named django.core.management

Actually, Python is included in Mac from the beginning

Launch the Terminal app and check the version

$ python --version

Python 2.7.5

I didn't notice this, and I thought it was Python installed with homebrew, but it was different.

$ which python

/usr/bin/python

I didn't notice the latest version of Python in Mavericks ...

Homebrew installation

It seems that the installation method of Command Line Tools has changed from Xcode 5.0, so install it with the following command

$ xcode-select --install

Homebrew installation

$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Finally, check if it completed normally with the following command

$ brew doctor

Your system is ready to brew.

When it comes out, it is completed

Python installation

By entering Python with the brew command, pip (Python package management) is also included.

$ brew install python

Keep pip up to date

$ pip install --upgrade setuptools$ pip install --upgrade pip

Set homebrew and python environment path

echo 'export PATH=/usr/local/bin:/usr/local/share/python:$PATH' >> ~/.bash_profile
source ~/.bash_profile

Confirm

$ python --version

Python 2.7.5

$ which python

/usr/local/bin/python

Install Django and create a project

$ pip install django

Create a project

django-admin.py startproject sample_project

This will create a directory called sample_project in the current directory, so let's move it.

cd sample_project
python manage.py runserver

Access http://127.0.0.1:8000/, and if the following screen is displayed, the environment construction is complete.

It worked!

Recommended Posts

Prepare Django development environment using homebrew on MacOSX Mavericks (10.9)
Django environment development on Windows 10
Build a Django development environment using pyenv-virtualenv on Mac
Prepare Python development environment on Ubuntu
[Memo] Django development environment
Build a Python development environment using pyenv on MacOS
Django development environment construction memo
[Django] Notes on using django-debug-toolbar
django project development environment construction
[Day 1] Prepare Django's development environment
Build an environment for machine learning using Python on MacOSX
Create a Python (pyenv / virtualenv) development environment on Mac (Homebrew)
Building a Jupyter Lab development environment on WSL2 using Anaconda3
Until building a Python development environment using pyenv on Ubuntu 20.04
WEB application development using Django [Django startup]
WEB application development using Django [Application addition]
[For beginners] Django -Development environment construction-
Install Python development environment on Windows 10
Prepare Python development environment with Atom
Prepare the development environment with anyenv
Mac OS X Mavericks 10.9.5 Development environment construction
WEB application development using Django [Model definition]
Addition of local development environment on MacOS
Python development environment for macOS using venv 2016
WEB application development using Django [Initial settings]
CSS environment created in 10 minutes using Django
Building a virtual environment using homebrew + pyenv-virtualenv
How to prepare Python development environment [Mac]
WEB application development using Django [Request processing]
About the development environment you are using
Application development using SQLite with Django (PTVS)
Prepare the development environment for keyhac for Mac
Prepare the development environment for Python on AWS Cloud9 (pip install & time change)
How to run a Django application on a Docker container (development and production environment)
Build Python + django + nginx + MySQL environment using docekr
Introduction to Python Let's prepare the development environment
Build Django + NGINX + PostgreSQL development environment with Docker
Build the fastest Django development environment with docker-compose
WEB application development using Django [Admin screen creation]
Until Django application creation by terminal (development environment)
Python development on Ubuntu on AWS EC2 (using JupyterLab)
[Python] Build a Django development environment with Docker
Build a Python development environment on your Mac
Build a Django development environment with Doker Toolbox
Build a Kubernetes environment for development on Ubuntu
Set up an Objective-C 2.0 development environment on Linux
From 0 to Django development environment construction to basic operation
Create a Python virtual development environment on Windows
Build a Python development environment on Raspberry Pi