Steps from installing Python 3 to creating a Django app

Confirmation of Mac pre-installation

$ python --version
Python 2.7.10
$ which python
/usr/bin/python

Install Python 3 with Homebrew

If you install it with Homebrew, it will be convenient because it will symbolically link python3.x to the python3 command or the pip command described later.

--XCode is already installed --homebrew is already installed

Confirm installation version

$ brew search python
app-engine-python             [email protected]             micropython                   python-markdown               wxpython
boost-python                  gst-python                    python                        python3                       zpython
caskroom/cask/kk7ds-python-runtime                                          caskroom/cask/mysql-connector-python

Installation

brew install python3

PATH setting

~/.bash_profile


export PATH=/usr/local/bin:$PATH
$ source ~/.bash_profile
$ python -V
Python 2.7.10
$ python3 -V
Python 3.6.1

pip installation

Python package manager. It will come with you when you install python3.

$ pip3 list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
setuptools (32.2.0)
wheel (0.29.0)

Put pip.conf, specify the format, and it was warned, so it corresponds. Mac seems to be in $ HOME / Library / Application Support / pip / pip.conf, but I didn't have it, so I created it.

$ cd /Users/kumanoshuta/Library/"Application Support"
$ mkdir pip
$ cd pip
$ vi pip.conf

[list]
format=columns
$ pip3 list
Package    Version
---------- -------
pip        9.0.1  
setuptools 32.2.0 
wheel      0.29.0 

Install pyenv

It provides a virtual environment for switching the version of python itself and the packages used.

I'm wondering if version switching is necessary or if docker or vergrant is fine, so I'll omit it.

Django installation

$ pip3 install django
Collecting django
  Downloading Django-1.11.2-py2.py3-none-any.whl (6.9MB)
    100% |████████████████████████████████| 7.0MB 207kB/s 
Collecting pytz (from django)
  Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
    100% |████████████████████████████████| 491kB 1.7MB/s 
Installing collected packages: pytz, django
Successfully installed django-1.11.2 pytz-2017.2
$ pip3 list
Package    Version
---------- -------
Django     1.11.2 
pip        9.0.1  
pytz       2017.2 
setuptools 32.2.0 
wheel      0.29.0 

Generate and launch a Django app

$ django-admin startproject mysite
$ python3 manage.py runserver 0.0.0.0:8000
Performing system checks...

System check identified no issues (0 silenced).

You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

June 13, 2017 - 04:16:41
Django version 1.11.2, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:8000/

I got an error, but I was able to start it.

download.png

Next, do DB settings

Recommended Posts

Steps from installing Python 3 to creating a Django app
Steps from installing Django to displaying an html page
Steps to create a Django project
How to launch AWS Batch from a python client app
Python: Introduction to Flask: Creating a number identification app using MNIST
Send a message from Python to Slack
From installing Ansible to building a Python environment in Vagrant's virtual environment
Use Django from a local Python script
Edit Excel from Python to create a PivotTable
How to open a web browser from python
How to develop a cart app with Django
DJango Memo: From the beginning (creating a view)
How to generate a Python object from JSON
Steps to develop a web application in Python
Steps to create a Twitter bot with python
Run a Python file from html using Django
I want to upload a Django app to heroku
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Deploy a Python 3.6 / Django / Postgres web app on Azure
From setting up Raspberry Pi to installing Python environment
The wall of changing the Django service from Python 2.7 to Python 3
(Python) Try to develop a web application using Django
App development to tweet in Python from Visual Studio 2017
Deploy a Django application on Google App Engine (Python3)
How to build a Django (python) environment on docker
DJango Note: From the beginning (creating a view from a template)
From buying a computer to running a program with python
Consider a conversion from a Python recursive function to a non-recursive function
How to use Django on Google App Engine / Python
Write code to Unit Test a Python web app
To myself as a Django beginner (1) --Create a project app--
Python script to create a JSON file from a CSV file
To myself as a Django beginner (4) --Create a memo app--
[Python] How to call a c function from python (ctypes)
How to create a kubernetes pod from python code
Post from Python to Slack
Introduction to Python Django (2) Win
Cheating from PHP to Python
A road to intermediate Python
Anaconda updated from 4.2.0 to 4.3.0 (python3.5 updated to python3.6)
Switch from python2.7 to python3.6 (centos7)
Connect to sqlite from python
[Django] A memorandum when you want to communicate asynchronously [Python3]
[Django] A pattern to add related records after creating a record
How to slice a block multiple array from a multiple array in Python
How to run a Python program from within a shell script
I want to start a lot of processes from python
Build a bulletin board app from scratch with Django. (Part 2)
Build a bulletin board app from scratch with Django. (Part 3)
I want to send a message from Python to LINE Bot
A quick explanation from creating AWS Lambda Layers to linking
Extract the value closest to a value from a Python list element
Call Matlab from Python to optimize
Call a Python function from p5.js.
How to write a Python class
Steps to develop Django with VSCode
Django: Import a class from a string
Deploy Django + React from scratch to GKE (3) Create a GCP project
Building a Python development environment on Windows -From installing Anaconda to linking Atom and Jupyter Notebook-
Post from python to facebook timeline