Python3 + Django ~ Mac ~ with Apache

Surprisingly, there was nothing in this area, so make a note. By default on Mac Python 2.7.9 Is installed.

Preparing pyenv

pyenv manages the Python environment. It is possible to switch and manage different versions of Python.

Install pyenv

For Mac, install with brew.

$ brew install pyenv-virtualenv

Python installation

Install 3.4.3.

$ pyenv install 3.4.3

Set 3.4.3 globally.

$ pyenv global 3.4.3

Check if it is set globally

$ python -V

mod_wsgi mod_wsgi is a module for running Python on Apache.

Installation

$ brew install mod_wsgi

Apache settings

Add the following to httpd.conf.

LoadModule wsgi_module [module to path]

See below for setting to virtualhost. http://django-project-skeleton.readthedocs.org/en/latest/apache2_vhost.html

Daemon Mode wsgi_mod defaults to "Embedded Mode". In "Embedded Mode", the python file is not updated unless Apache is restarted. To reflect the python modification immediately, set it to "Daemon Mode". Put "processes = 2 threads = 15 display-name =% {GROUP}" in "WSGI Daemon Process".

WSGIDaemonProcess example.com processes=2 threads=15 display-name=%{GROUP}

[reference] https://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process

Recommended Posts

Python3 + Django ~ Mac ~ with Apache
Django 1.11 started with Python3.6
CentOS 6.4 with Python 2.7.3 with Apache with mod_wsgi and Django
Do Django with CodeStar (Python3.6.8, Django2.2.9)
Do Django with CodeStar (Python3.8, Django2.1.15)
Getting Started with Python Django (1)
Getting Started with Python Django (4)
Getting Started with Python Django (3)
Getting Started with Python Django (6)
Getting Started with Python Django (5)
Using OpenCV with Python @Mac
Make apache log csv with python
Run python3 Django1.9 with mod_wsgi (deploy)
Until you run python with apache
Introduction to Python Django (2) Mac Edition
Install python with mac vs code
Word Count with Apache Spark and python (Mac OS X)
FizzBuzz with Python3
Scraping with Python
Statistics with python
Get started with the Python framework Django on Mac OS X
Python Django Tutorial (5)
Python Django Tutorial (2)
Scraping with Python
Handle multiple Django projects with Apache (WSGIDaemonProcess)
Python with Go
Internationalization with django
Twilio with Python
Django + Apache with mod_wsgi on Windows Server 2016
Integrate with Python
Follow active applications on Mac with Python
Play with 2016-Python
AES256 with python
Tested with Python
Python Django Tutorial (8)
python starts with ()
Python Django Tutorial (6)
Build Python environment with Anaconda on Mac
python on mac
with syntax (Python)
CRUD with Django
Bingo with python
Zundokokiyoshi with python
Python Django Tutorial (7)
Python Django Tutorial (1)
Python Django tutorial tutorial
Python Django Tutorial (3)
Excel with Python
Microcomputer with Python
Python Django Tutorial (4)
Cast with python
Project cannot be created with Python3.5 (Windows) + django1.7.1
[Python] Build a Django development environment with Docker
Create Nginx + uWSGI + Python (Django) environment with docker
Django with Python Tools 2.2 for Visual Studio (PTVS 2.2)
Try working with Mongo in Python on Mac
Let's integrate Django and apache (httpd) on Mac! !!
Put Python 2.7.x on Mac OSX 10.15.5 with pyenv
A simple to-do list created with Python + Django
What Python beginners got hooked on with Django
Quickly build a Python Django environment with IntelliJ