Printing the generated query including parameters

January 16, 2020 Leave a comment

https://www.johbo.com/2016/printing-the-generated-query-including-parameters.html

Categories: Interesting, python Tags: ,

How We Got To Continuous Deployment With Rails, CircleCI, and Heroku

January 6, 2020 Leave a comment

View at Medium.com

Categories: Interesting

Getting Started with Heroku – notes

January 6, 2020 Leave a comment

Notes:

1. Install the heroku cli.
2. If you have a preexisting git repository with the desired files to be pushed to heroku.
You need to have at minimum a Procfile and requirements.txt file

$ less Procfile
web: gunicorn wsgi:app
$ less requirements.txt
Flask==1.0.3
alembic==1.0.10
...
gunicorn==20.0.4

3. Merge changes into master branch if working off a different branch.
4. Login into heroku.
$ heroku login
5. Create a heroku app. You can specify a name for the app. Below command generate a random name.
$ heroku create
To create an app outside the default region of the us.
$ heroku create midnight-cask-76349 --region eu
6. Create a heroku postgres database.
$ heroku addons:create heroku-postgresql:hobby-dev
7. Push changes up to heroku app. Alembic changes get applied automatically on successful deploy.
$ git push heroku master
8. Set application `Config vars` under settings on the dashboard
9. Get database application details from dashboard. Follow link from database details under installed addons section. THe database url details will be available under the linked settings. Also have instructions on how to connect to database
$ heroku pg:psql postgresql-sparkle-97339 --app midnight-cask-76349
10. To manually run alembic
$ heroku run alembic upgrade head
11. To check logs
$ heroku logs --tail
12. To get database credentials
$ heroku pg:credentials:url
13. You can clone the heroku repo for the app locally
$ heroku git:clone -a midnight-cask-76349

Sources:
https://stackabuse.com/deploying-a-flask-application-to-heroku/
https://stackoverflow.com/questions/34379130/pushing-to-heroku-fails-no-such-app-fatal
https://elements.heroku.com/addons/heroku-postgresql
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-14-04
https://blog.dbi-services.com/a-free-postgresql-cloud-database/
https://devcenter.heroku.com/articles/heroku-postgresql#designating-a-primary-database

Categories: postgresql, python Tags:

Announcing Message DB: Event Store and Message Store for PostgreSQL

December 30, 2019 Leave a comment

The Eventide Project team is excited to announce Message DB: A fully-featured event store and message store implemented in PostgreSQL for pub/sub, event sourcing, and evented microservices applications.

For more specifics, visit Message DB on GitHub:
https://github.com/message-db/message-db

https://blog.eventide-project.org/articles/announcing-message-db/

Categories: Interesting Tags: ,

JetBrains Academy Welcomes Kotlin On Board!

December 30, 2019 Leave a comment
Categories: Interesting

SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)

November 30, 2019 Leave a comment

Problem:
I was not able to run $ python3.7 -m pip install --upgrade pip on my Ubuntu 14.0 (Trusty) box. I was getting an error similar to

Could not fetch URL https://pypi.org/simple/slackclient/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=’pypi.org’, port=443): Max retries exceeded with url: /simple/slackclient/ (Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)) – skipping

Solution:
I had to manually install openssl and python3.7 for it to work on Ubuntu Trusty.

Sources:

https://help.dreamhost.com/hc/en-us/articles/115000702772-Installing-a-custom-version-of-Python-3

https://help.dreamhost.com/hc/en-us/articles/360001435926-Installing-OpenSSL-locally-under-your-username

Categories: python Tags:

Providing feedback and notifications to users using Flask’s flash function

November 24, 2019 Leave a comment

Providing feedback to users of a web application is critical, from notifications and error messages to warnings and progress alerts.

If the application doesn’t the right level of feedback, chances are the user will become frustrated and end up having a bad experience.

Fortunately for us, Flask provides a simple way to send messages from the server to the client using flash.

https://pythonise.com/series/learning-flask/flask-message-flashing

Categories: flask