The wall of changing the Django service from Python 2.7 to Python 3

Chira back class. It's sad to forget

Premise

A long time ago, something that I wrote properly in Python 2.7 is still alive, so I fixed it. It's a pain because I'm doing bad practices that I don't do now.

Celery

Deprecated when djcelery notices?

From around Celery 3.1 (now Celery 4.0 series?) Celery itself supports Django.

It's good in itself, but the method has changed a little, and it's a sensuous expression, but the flow of "reading the Celery settings after loading the Django environment" is "to read the Django module after starting Celery". Maybe it's because of the "go" order, I end up putting modules in the execution directory

At some point, I feel like I'm confused if there is no proj / under / home / proj. Or add the module load path after starting Celery?

social-auth

Instructions to use social-auth-app-django.

I had the impression that the migration path was relatively well written, but it must have been a fairly destructive change, and all module names were changed.

https://github.com/omab/python-social-auth/blob/master/MIGRATING_TO_SOCIAL.md

Relative import

In a certain place, the local file (module) name is specified as a character string in the flow of performing the processing equivalent to __import__ (). This was not supplemented in 2to3. Since it does not contain ., it means "not", and as a result, it is assumed that it is not fully loaded. Another process ran, which caused a lot of trouble.

String, bytes

In the first place, it may be possible to write without clearly distinguishing str and unicode Python 2, Suddenly there is a part of confusion when asked to make it strict.

There are many cases where Popen () is used on the system, but it is revealed that it is sloppy due to the character encoding such as stdout. Especially when throwing from stdout to yet another function, is it bytes or str?

I wonder if there was any confusion this time for those who have strict external modules. In the past, I remember eating the csv module and other basic things. I have no choice but to adapt to the new method after being confused.

Python 3.4 -> Python 3.5

The experimental environment is Ubuntu 14.04 and the other environment is Ubuntu 16.04, and I was angry with  Ľopen (filename,'b') when migrating. ```open (filename,' rb') ``.

Summary

This time, the impression was that the disaster that hadn't been maintained for a while was bigger than Python 2-> 3.

Recommended Posts

The wall of changing the Django service from Python 2.7 to Python 3
Existence from the viewpoint of Python
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
How to check the version of Django
[Python] Try to graph from the image of Ring Fit [OCR]
Learning notes from the beginning of Python 1
From the introduction of JUMAN ++ to morphological analysis of Japanese with Python
The story of pep8 changing to pycodestyle
Learning notes from the beginning of Python 2
Try using the Python web framework Django (1)-From installation to server startup
Get the contents of git diff from python
Change the decimal point of logging from, to.
From the introduction of pyethapp to the execution of contract
The story of moving from Pipenv to Poetry
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
the zen of Python
I tried to deliver mail from Node.js and Python using the mail delivery service (SendGrid) of IBM Cloud!
About the handling of ZIP files including Japanese files when upgrading from Python2 to Python3
The story of switching the Azure App Service web system from Windows to Linux
Easy way to check the source of Python modules
python beginners tried to predict the number of criminals
[Python] How to remove duplicate values from the list
How to know the port number of the xinetd service
Template of python script to read the contents of the file
How to get the number of digits in Python
Learn Nim with Python (from the beginning of the year).
[Python] Get the text of the law from the e-GOV Law API
[python] option to turn off the output of click.progressbar
Study from the beginning of Python Hour1: Hello World
Get the return code of the Python script from bat
Python points from the perspective of a C programmer
I wanted to use the Python library from MATLAB
Referencing and changing the upper bound of Python recursion
Steps from installing Python 3 to creating a Django app
The first step to getting Blender available from Python
[Python] Summary of how to specify the color of the figure
14 quizzes to understand the surprisingly confusing scope of Python
Study from the beginning of Python Hour8: Using packages
[Introduction to Python] Basic usage of the library matplotlib
To do the equivalent of Ruby's ObjectSpace._id2ref in Python
Completely translated the site of "The Hitchhiker's Guide to Python"
Python Note: The mystery of assigning a variable to a variable
[Python] Let's change the URL of the Django administrator site
I tried to summarize the string operations of Python
From the initial state of CentOS8 to running php python perl ruby with nginx
Extract images and tables from pdf with python to reduce the burden of reporting
Post from Python to Slack
Towards the retirement of Python2
Introduction to Python Django (2) Win
Cheating from PHP to Python
About the ease of 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
About the features of Python
The Power of Pandas: Python
I tried to find the entropy of the image with python
[Python] Change the Cache-Control of the object uploaded to Cloud Storage
DJango Note: From the beginning (simplification and splitting of URLConf)
Try to get the function list of Python> os package