我已经按照本教程启动并运行了 Flask https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-flask-app/
我希望 Postgres 作为我的数据库系统,但我使用的是 Web 应用程序,所以我不能只登录 VM 并安装它。我在这里能做什么?
谢谢
最佳答案
我们似乎没有权限在 Azure Web APP 服务器上安装 PostgreSQL 数据库。您需要在 Azure VM 上安装 PostgreSQL。
例如:
A.如果您创建了 Windows Server VM,请参阅链接 https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-tutorial/并连接您的虚拟机。
在链接页面http://www.enterprisedb.com/products-services-training/pgdownload#windows ,您可以下载 PostgreSQL Windows Installer 文件并在虚拟机上运行它,以使用默认配置逐步安装它。
PostgreSQL默认端口为2345。请确保Windows Server防火墙允许该端口访问,并尝试使用本地主机上的VM DNS NAME测试连接,然后您可以继续开发。
B.如果您创建的是Ubuntu等Linux虚拟机,请引用链接https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-tutorial/并连接您的虚拟机。
要安装 PostgreSQL,您可以使用 Linux 包管理工具。 引用链接:https://wiki.postgresql.org/wiki/Detailed_installation_guides
Ubuntu/Debian:
$ sudo apt-get update
$ sudo apt-get install postgresql
红帽/CentOS: 引用链接:http://wiki.postgresql.org/wiki/YUM_Installation
您可以在 Flask for PostgreSQL 中使用 SQLAlchemy ORM 框架,请引用http://flask.pocoo.org/docs/0.10/patterns/sqlalchemy/和 http://docs.sqlalchemy.org/en/rel_1_0/dialects/postgresql.html .
关于python - Azure Flask Web 应用程序中的 Postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31769569/