This article focuses on some of the issues of deploying Python's Django Framework on the SAE, the SAE is an online app deployment platform for Sina and provides support for Python applications, and friends can refer to
It took some time to deploy the debris network to the SAE, and encountered various problems halfway. It feels like the SAE looks beautiful, but it's actually not too mature (at least Python version).
Here's a note of some of the major problems I've encountered and how to solve them.
Django Version problem
Django1.4 are about to be released, SAE platform with the SAE version is still 1.2x. To use the django1.3 version, you need to upload your own Django. You can refer to the RUNTIME.HTML#VIRTUALENV in SAE manual for the specific procedure.
Log module Error
The first encounter is the day to module problem. The error shows that a class is constructed in Adminemailhandler with the Is_mail parameter, but the constructor of the target class is not supported at all. Good day to the module is not required. Replace the day to processing module with Django.utils.log.NullHandler to solve the problem.
?
1 |
' null ': {' level ': ' DEBUG ', ' class ': ' Django.utils.log.NullHandler ',}, |
Local_thread problem
Join in the Index.wsgi
?
1 2 3 |
Import threading from Django.utils import _threading_local threading.local = _threading_local.local |
Settings file
The SAE defaults to installing a number of Python packages, including Django-userena. The bad thing is that SAE adds Django-userena's demo project to the Python path, and the load priority is higher than the project code. directly causing os.environ[' django_settings_module '] = ' settings ' to find the Userena settings file. Eventually renaming the settings file to qnotes_settings.py solves the problem.
Other issues
A database error has often occurred since the deployment was launched yesterday, with the error prompted by caught Operationalerror while rendering: (1045, ' access deny '). The SAE database does not support long connections, and the active timeout after 30s. But Django will automatically shut down the database connection after each request, and there should be no such problem in theory. The question today baffled itself well.
The server is very unstable, often inaccessible for extended periods of time, and can be accessed normally at irregular intervals.
The SAE may have hack the Python package loading mechanism, and the SAE Python package loading behavior is strange. The package should have been loaded in the current directory first, but not necessarily.