I'm having some trouble with a Django application deployed on Google App Engine.
I still don't know how to replicate the issue.
It seems like the application randomly freezes. It just stops responding (no log is produced in the meanwhile) and, if I go in any application page, I get this error:
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
No error is shown in the logs and the only strange warning I found is this one:
OpenBLAS WARNING - could not determine the L2 cache size on this system, assuming 256k
I don't have any issues when I run the application on my Ubuntu machine.
I'm using Django 2.1.5 with Python 3.7 and Django connects to a MySQL instance (on Google Cloud SQL).
Additional information:
The app.yaml file is very basic and is taken straight from the official example:
# [START django_app]
runtime: python37
service: backend
handlers:
# This configures Google App Engine to serve the files in the app's static
# directory.
- url: /static
static_dir: static/
# This handler routes all requests not caught above to your main app. It is
# required when static routes are defined, but can be omitted (along with
# the entire handlers section) when there are no static files defined.
- url: /.*
script: auto
# [END django_app]
Excerpt of Django configuration:
INSTALLED_APPS = [
...
'rest_framework',
'rest_framework_filters',
'django_rest_passwordreset',
'django_filters',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.AllowAny',
],
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication',
],
'DEFAULT_FILTER_BACKENDS': [
'rest_framework_filters.backends.RestFrameworkFilterBackend',
'django_filters.rest_framework.DjangoFilterBackend',
],
}
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
'REFRESH_TOKEN_LIFETIME': timedelta(hours=10),
'ROTATE_REFRESH_TOKENS': True,
'ALGORITHM': 'HS256',
'SIGNING_KEY': "XXXXXX",
}
It's worth noting that there are custom installed apps that access the MySQL database both using the usual Django ORM and by directly querying a number of different databases using the pymysql library.