问题描述
我遵循了这个: Tutorial: Deploy a Django web app with PostgreSQL in Azure App Service
我创建了数据库和应用程序,直到进入:
运行Django数据库迁移
通过导航到浏览器来打开SSH会话 https://.scm.azurewebsites.net/webssh/host 运行“ python manage.py migration”
它给了我这个错误
FATAL: Invalid Username specified. Please check the Username and retry
connection. The Username should
be in <username@hostname> format.
(antenv) root@5f4958961a00:/home/site/wwwroot#
我不知道应将哪个“用户名”更改为username @ hostname
提前thnx
解决方法
当您create Postgres database in Azure使用命令时:
az postgres up --resource-group DjangoPostgres-tutorial-rg --location westus2 --sku-name B_Gen5_1 --server-name <postgre-server-name> --database-name pollsdb --admin-user <admin-username> --admin-password <admin-password> --ssl-enforcement Enabled
该命令完成后,它将输出一个JSON对象,该对象包含数据库的不同连接字符串以及服务器URL,生成的用户名(例如“ joyfulKoala @ msdocs-djangodb-12345”)和GUID密码。
例如,
...
"host": "postgres-server-name.postgres.database.azure.com","password": "somePassword","username": "wert@postgres-server-name"
}
您可以将上述格式的用户名和密码复制到configure environment variables to connect the database。