Discover Flask, Part 13 - Heroku PostgreSQL Setup

preview_player
Показать описание
Today we'll re-cap the steps we took in the last video to setup PostgreSQL on Heroku and then finalize the setup by setting the schema and adding data.

If you like this video and want to see more, thumbs up, favorite, comment, and/or subscribe. Thanks!

Links:

Рекомендации по теме
Комментарии
Автор

For Windows users: You can now install psycogp2 directly over pip:

paulniebler
Автор

I am glad to found this tutorial, I was struggling to import some data from Dev to Prod. Thanks, Michael!

MarcoBurgos
Автор

about command on 1:00: heroku config | grep HEROKU_POSTGRESQL
for windows use just heroku config, it will show all your configs, such as APP_SETTINGS and DATABASES

lastedgeco
Автор

For those trying to install psycopg2 with pip on windows and running into errors, you need to download the executable binary and install it using easy_install (you already have it if you are using pip).

Автор

Hi Michael, Thank you for sharing such a wonderful series of tutorial. It is really helpful for me who is beginner in flask development.
I am working on an Android App for a small non-profit organization as part of my social work. I am trying to use Flask + Heroku Postgres for the developing REST APIs for the App. The idea is to have an admin account for them to feed the data into the database and have some methods (endpoints) in the web app (app.py) that queries the database and return the data in JSON format. Those endpoints will serve as REST APIs for their Android App. Does it make sense to you ?
Another question is about scaling, does accessing the endpoints from an Android App will count as a connection to database? As I see Heroku provides only 20 connections to DB in free account. And my case thousand of Apps will access the endpoint/API for availability of new data.
Thank you once again for all your help!
P.S. - Sorry for such a long comment. Its a typical beginner's style comment :)
Thanks

webcrunch
Автор

I've really enjoyed this tutorial so far - it has been very helpful for me. I've spent the past couple of hours trying to get pip install psycopg2 to install in my venv. I'm running OS X El Capitan. This is the error message I get:

abmorton$ pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.6.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating
writing
writing top-level names to
writing dependency_links to
writing manifest file
warning: manifest_maker: standard file '-c' not found

Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.


Command "python setup.py egg_info" failed with error code 1 in

Please help - thanks again!

MrRandomatom
Автор

Hey Michael. We committed our project with production config that declares a connection to sqlite:///posts.db database. After it all was committed, Heroku changed URL for the database and set it to postgresql. How does it do and what if did not have a config file? Thanks for tutorials and answers.

igors.
Автор

I'm not sure why, but it doesn't let me respond directly to your comments, Marjorie. 

hermanmu
Автор

I'm pretty sure I followed along correctly. I ran the db_create.py and it didn't throw any errors but when when I go to the page my logs say they can't find the table. Any clues?

Desdinova
Автор

Is it an issue that when I install the psycopg2 I get:
unable to execute llvm-gcc-4.2: No such file or directory.
Additionally, I get a red error, too long to enter here. I'll try installing x-code or the command line tools to see if that helps.

UPDATE: Thanks for the response. I didn't see it until I succeeded (which took me close to three hours). In essence, I had to install:
1. Apple > Software Updates
2.  XCode, which took a very long time, with a few dead-ends until it worked.
3. Command Line Tools. Oddly difficult to find in the Apple Store and Developer pages (at least a version that would work on my system). Ended up using the
XCode Preferences > Downloads method that your resource pointed to.

After doing all three, I was successful running:
$ pip install psycopg2
And now I can continue!

marjorieroswell