Skip to content

A response functionality and possible future follower mechanic.

CSDUMMI requested to merge UserRelationsAndMessageRelations into master

This Branch implements two important features: The ability to respond to a post with another post. All responses to a post are listed below the post itself and make discussion possible. The other feature is a Follower relationship between users. This relationship isn't used yet, but we can use it in the future, to model something like:

  • Subscribers on YouTube
  • Followers on Twitter But not Friends, like on Facebook, because the relation is established, with only one party agreeing to it.

Technical description

docker-compose up --build app

For the developers among you, the most interesting new feature might be, that I have created a docker-compose.yml File and that you can now easily test the server with.

Prerequisites

Before starting the server, you need to fill the .env file with some important Environment variables:

POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=<name of the database, doesn't really matter, but if in doubt use demnet>
GITLAB_TOKEN=<private token of your account, where you have either the real DemNet or a fork of it>
DEMNET_ID=<GitLab ID of the DemNet project or your fork of it>
DEMNET_LOCATION=<https://gitlab.com/CSDUMMI/demnet in case of the real demnet>
SECRET_KEY=<some random data, that isn't disclosed to anyone>

Then you can execute the app with this:

$ docker-compose up --build app

I combined the postgres container with the Dockerfile, now called app. It starts a Postgres server on port 5432 and the app's server on port 5000. To properly initialize the database, you still need to execute two things, though:

$ docker-compose exec app python3 -c "from Server.Database import *; create_tables();register('joris', 'Joris', 'Gutjahr', 'a', 'root')

You have to register either a user with the username joris or abbashan or change the $DEMNET_ADMINS variable in docker-compose.yml.

peeweedbevolve

I'm using peewedbevolve, which automatically takes the database schema in peewee and applies it to the database. It automatically migrates the database to a new version and initializes an empty one, if it doesn't already exist. This means, we can simply write our changes to the database, without any worry about loosing data. create_tables now uses database.evolve( interactive = False ) internally.

I hope you will have a good experience with these changes.

Edited by CSDUMMI

Merge request reports