【发布时间】:2020-04-09 11:53:46
【问题描述】:
我使用 App Engine 标准环境托管了 Django 应用程序。当我尝试登录时,它给了我 'attempt to write a readonly database' 错误。我已将 URL 添加到 ALLOWED HOSTS 并在 DATABASE 的 settings.py. 中添加了管理员凭据,其他一切都按预期工作。
app.yaml
# [START django_app]
runtime: python37
service: hellotest1
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]
settings.py - 数据库和 ALLOWED_HOSTS
ALLOWED_HOSTS = ['url']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'USER': 'admin',
'PASSWORD': 'admin',
}
}
【问题讨论】:
标签: django sqlite google-app-engine