【发布时间】:2019-02-26 04:58:12
【问题描述】:
有人将此标记为重复 - 由于以下原因,它不是他们链接到的问题的重复。首先,我不会为每个 url 收到 404 错误。我得到了一些模板而不是其他模板,我在模板文件夹的顶层获取了所有模板,而不是子目录中的模板。它还给出了 500 个错误而不是 404 个错误,这是不同类别的错误。
我一直在尝试将 django(2.1) (python3) 应用程序放在 google 的灵活应用引擎上,但遇到了以下问题:
应用程序不会呈现模板文件夹子目录中的任何模板,它会给出 500 错误。我一直在通过 gcloud 控制台和管理界面查看日志的尾部,但没有看到任何有用的信息。
我的 app.yaml 是:
runtime: python
# api_version: 1
env: flex
entrypoint: gunicorn -b :$PORT MyApp.MyApp.wsgi
runtime_config:
python_version: 3
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
env_variables:
SECRET_KEY: 'key-here'
DEBUG: 'False'
DB_HOST: '/cloudsql/instance:region:instance'
DB_PORT: '5432'
DB_NAME: 'instance'
DB_USER: 'postgres'
DB_PASSWORD: 'db-password'
STATIC_URL: 'https://storage.googleapis.com/bucket-name/static/'
beta_settings:
cloud_sql_instances: 'instance:region:instance'
我的模板文件夹设置: BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(文件)))
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, 'templates', 'subdir'),
os.path.join(BASE_DIR, 'templates', 'subdir', 'othersubdir'),
等等
我真的很难过。任何有关从何处获取更详细的错误日志或可能存在的问题的建议或反馈将不胜感激 - 谢谢!!!
【问题讨论】:
-
是只在 App Engine 上失败,还是在本地也失败?
-
仅在应用引擎上,在本地它与开发服务器和 gunicorn 都可以正常工作。
-
This 问题与您的问题相似。
-
这不是同一个问题,但感谢您的链接。
标签: django python-3.x google-app-engine app-engine-flexible