friartuck
friartuck

Reputation: 3121

Postgres in Azure Flask Web App

I've got Flask up and running as per this tutorial https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-flask-app/

I want Postgres to be my database system, but I'm in a Web App, so I can't just log into the VM and install it. What can I do here?

Thanks

Upvotes: 2

Views: 741

Answers (1)

Peter Pan
Peter Pan

Reputation: 24148

It seems that we don’t have permission to install PostgreSQL database on Azure Web APP server. You need install PostgreSQL on Azure VM.

For examples:

A. If you created a Windows Server VM, refer to the link https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-tutorial/ and connect your VM.

At the link page http://www.enterprisedb.com/products-services-training/pgdownload#windows, you can download a PostgreSQL Windows Installer file and run it on your VM to install it using default configuration step by step.

The PostgreSQL default port is 2345. Make sure the Windows Server Firewall allow the port accessing and try to test the connection by using VM DNS NAME from your local host, and then you can continue to develop.

B. If you create a Linux VM such as Ubuntu,refer to the link https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-tutorial/ and connect your VM.

To install PostgreSQL, you can use Linux Package Management Tool. Refer to the link:https://wiki.postgresql.org/wiki/Detailed_installation_guides

Ubuntu/Debian:

$ sudo apt-get update
$ sudo apt-get install postgresql

RedHat/CentOS: Refer to the link:http://wiki.postgresql.org/wiki/YUM_Installation

You can use SQLAlchemy ORM Framework in Flask for PostgreSQL, please refer to http://flask.pocoo.org/docs/0.10/patterns/sqlalchemy/ and http://docs.sqlalchemy.org/en/rel_1_0/dialects/postgresql.html.

Upvotes: 2

Related Questions