Packaging Python projects for Debian / Raspbian with dh-virtualenv

This article aims to explain some things to developers which don’t use Python a lot, and might struggle with some of the concepts otherwise. I highly recommend the lecture of the following article as an introduction to the concepts discussed here: https://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/ pypi.org pypi.org is an official repository of software for the Python programming language.…

Weiterlesen

mongo_orm custom name for collection

mongo_orm will automatically determine the name for your collection by using the Module and Class name, and appending an “s”. In cases where you want to name your collection, you can simply do this: class PapiTest < Mongo::ORM::Document     collection_name “Buster”     field test : String end get “/” do     pt = PapiTest.new     pt.test = “I want…

Weiterlesen

Instructions for adding a user to a mongo database for mongo_orm

You don’t want your web application to access the database using your database admin user. Additionally you want it to access only one specific database – maybe you have additional databases running in your mongo instance. Prerequisites: mongo_orm expects the database configuration as environment variables or as a file config/database.yml in your project. The config/database.yml…

Weiterlesen

kemal-session does not persist data

https://github.com/kemalcr/kemal-session Analyse what is happening with your session cookie. In my case, the session cookie was reset everytime I went to login. I realized, that my idea of cleaning up the old session as a first statement after successful login, before setting up the new session is not a good idea. I suspect, that the…

Weiterlesen

Using modules in crystal

As your application grows, you would like to move from one big .cr file to separating your code into smaller files. You can use require from your main .cr file to add code from other files: require “./tools/*” This statement will add code from the tools directory, relative to your main .cr file. This will…

Weiterlesen

Route & Redirect with envoy

An example envoy.yaml showing how to route & redirect. There are different options, see here https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/route/route.proto#route-redirectaction This envoy.yaml routes /taxgod and /taxgod/ (the second could probably be omitted because the first one should also match it, I think) to a new port and a different protocol. /picockpit is simply redirected to / and then finally…

Weiterlesen

Envoy routing and rewriting snippet

It is possible to rewrite URLs with Envoy for the backend. Please note that the HTML output needs to have the proper routes! (That is why I am not going to investigate further in this direction). REF: https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/route/route.proto#route-route  Also note that the string is going to be rendered literally for direct_response –> body –> inline_string,…

Weiterlesen