Try Debian + Python 3.4 + django1.7 ...

Looking back, the ending is too stupid, but I did it for the time being, so I recorded it.

What I wanted to do

Or, it is a request that "I want everything to work for the time being in the development environment itself with emacs and terminal open".

The bottom line is that you can go to ./manage.py runserver, but mod_wsgi doesn't allow the last request.

Reference link

work

I was feeling like, "If you move this far, you'll win for the time being. The rest is the setting of apache2."

WSGIDaemonProcess mysite user=www-data group=www-data processes=2 threads=2 \
  maximum-requests=100 umask=0007 \
  python-path=/opt/mysite:/opt/django1.7/lib/python3.4/site-packages
WSGIScriptAlias /mysite  /opt/mysite/mysite/wsgi.py
<Directory /opt/mysite/mysite>
    <Files wsgi.py>
        SetEnv PROCESS_GROUP mysite
        Order deny,allow
        Allow from all
    </Files>
</Directory>    

Make the SQLite DB writable from www-data for the time being.

(django1.7) > chmod 777 db.sqlite3
(django1.7) > chmod 777 .
(django1.7) > sudo service apache2 restart

(Visit http://localhost/mysite/admin)

Minor changes to urls.py and views.py to be confident that the version is really 3.4

urls.py


from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'mysite.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', 'mysite.views.home', name='home'),
)

views.py


from django.http import HttpResponse
import sys

def home(request):
    return HttpResponse(str(sys.version_info), content_type="text/plain")

result

If you run it from ./manage.py runserver (with venv activated)

sys.version_info(major=3, minor=4, micro=0, releaselevel='final', serial=0)

When running with apache2 + mod_wsgi

sys.version_info(major=3, minor=2, micro=3, releaselevel='final', serial=0)

Nyoro-n …… (If libapache2-mod-wsgi-py3 is not installed, this will be a 2.7 series and it will be even more shocking)

The apache2 log says it all.

[Thu May 01 17:01:31 2014] [notice] Apache/2.2.22 (Debian) mod_auth_tkt/2.1.0 PHP/5.4.4-14+deb7u9 mod_ssl/2.2.22 OpenSSL/1.0.1e mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Thu May 01 17:04:01 2014] [notice] caught SIGTERM, shutting down
[Thu May 01 17:04:02 2014] [warn] mod_wsgi: Compiled for Python/3.2.2rc1.
[Thu May 01 17:04:02 2014] [warn] mod_wsgi: Runtime using Python/3.2.3.

There orz

It's probably not possible to have multiple mod_wsgi, so I have to have Apache separately. If you do that, you should use docker or kvm. However, if you split the OS in that way, the configuration file will also split in all directions, so it is far from the initial request.

Postscript

I got the idea of using a reverse proxy from tornado + apache. The fact that I didn't know the tornado so far made me tremble

No, but I knew both xbuild and pyenv today. There is no choice.

Recommended Posts

Try Debian + Python 3.4 + django1.7 ...
Try python
Python Django Tutorial (5)
Python Django Tutorial (2)
Python> try: / except:
Python Django Tutorial (8)
Python Django Tutorial (6)
Python Django Tutorial (7)
Python Django Tutorial (1)
Python Django tutorial tutorial
Python Django Tutorial (3)
Python Django Tutorial (4)
Django 1.11 started with Python3.6
Try scraping with Python.
Python Django tutorial summary
Django python web framework
python try ~ except ~ else
Django Python shift table
[Personal notes] Python, Django
Try gRPC in Python
Try using Django templates.html
Try 9 slices in Python
Try using Tweepy [Python2.7]
Python Django CSS reflected
Python try / except notes
Python beginners try adding basic auth to Django admin
(Python) Try to develop a web application using Django
Do Django with CodeStar (Python3.6.8, Django2.2.9)
Try to understand Python self
Do Django with CodeStar (Python3.8, Django2.1.15)
Try Python output with Haxe 3.2
Try using Kubernetes Client -Python-
Python3 + Django ~ Mac ~ with Apache
Create ToDo List [Python Django]
Getting Started with Python Django (1)
Getting Started with Python Django (4)
Try LINE Notify in Python
Getting Started with Python Django (3)
Install Python 3.7 and Django 3.0 (CentOS)
Try running Python with Try Jupyter
GAE + python + Django addictive story
Try implementing Yubaba in Python 3
Getting Started with Python Django (6)
Python Django Tutorial Cheat Sheet
Try face recognition with Python
Getting Started with Python Django (5)
Try running python in a Django environment created with pipenv
Try using the Python web framework Django (2) --Look at setting.py
Try scraping with Python + Beautiful Soup
Azure Functions: Try Durable Functions for Python
Try IAM Database Authentication from Python
8 Frequently Used Commands in Python Django
Python
Python practice_Virtual environment setup ~ Django installation
Try the Python LINE Pay SDK
Try to operate Facebook with Python
Try implementing extension method in python
Try singular value decomposition with Python
Create new application use python, django
Try using Pleasant's API (python / FastAPI)
Try using LevelDB in Python (plyvel)