Skip to content

Python | Flask | PostgreSQL | Bootstrap | Livestream and videochat aggregator

Notifications You must be signed in to change notification settings

binawork/ktonadaje

Repository files navigation

KtoNadaje.pl

Livestream and videochat aggregator

Quicklinks

Table of contents

General info

The web application created as part of BINA.work. The main motivation to start work was the COVID-19 pandemic and the desire to help creators promote their online activity.

Technologies

name version description
Python 3.8.2
Flask 1.1.2
SQLALchemy 1.3.16
PostrgeSQL 10.12

Business Documantation

Setup

Development on Linux Ubuntu 18+

Clone project

To run the project locally, you need to have Python 3.8+ and PostgreSQL 10.12+ installed. If you already have it, go to the next steps.

Copy the source code to your machine:

git clone git@github.com:kMatejak/ktonadaje.git YYY
cd YYY

Create Python environment

Then create a virtual environment, checkout to branch develop and install all requirements. virtualenv is used to isolate Python modules so they don’t pollute your system. Our referenced version of the virtualenv in at least 16.7.8.

virtualenv env
source env/bin/activate
git checkout develop
pip install -r requirements.txt

(OPTIONAL) Set local variables with autoenv

To set up the application with environment variables you use autoenv (link). This program allows us to set commands that will run every time we cd into our directory. In order to use it, we will need to install it globally. First, exit out of your virtual environment in the terminal, install autoenv and then add an .env file:

deactivate
pip install autoenv==1.0.0
touch .env

Next, in your .env file, add the following:

source env/bin/activate
export FLASK_ENV=development
export FLASK_DEBUG=True
export APP_SETTINGS=config.DevelopmentConfig
export DATABASE_URL=postgresql://postgres:password@localhost/ktonadaje_dev

Run the following to update and then refresh your .bashrc:

echo "source `which activate.sh`" >> ~/.bashrc
source ~/.bashrc

Now, if you move up a directory and then cd back into it, the virtual environment will automatically be started and the APP_SETTINGS variable is declared.

Set local variables for development environment

This step is not necessary if you have passed the previous one. Skip to the next step.

To configure the application with environment variables, add the file .env in the project root and paste the following into it:

FLASK_ENV=development
FLASK_DEBUG=True
APP_SETTINGS=config.DevelopmentConfig
DATABASE_URL=postgresql://postgres:password@localhost/ktonadaje_dev

You can read more about connection URI format (the last line in this code snippet above) here.

Create local dev database

psql
CREATE DATABASE ktonadaje_dev;
\q

And then apply the upgrades from migrates to your database:

python manage.py db upgrade

Check it out!

Finally, check that the project works:

python app.py

Optionally, you can also insert sample data into your database. Just use the already prepared script:

python insert_sample_data_dev_db.py

Development on Windows 10

Clone project

To run the project locally, you need to have Python 3.8+ (link) and PostgreSQL 10.12+ (link) installed. Also this instruction assumes that you have Git installed with Bash extension (link). If you already have it, go to the next steps.

Open Git Bash, go to the directory where you want to clone the project and copy it to your machine:

$ git clone git@github.com:kMatejak/ktonadaje.git YYY
$ cd YYY

Create Python environment

Then create a virtual environment, checkout to branch develop and install all requirements. virtualenv is used to isolate Python modules so they don’t pollute your system. Our referenced version of the virtualenv is at least 16.7.8.

This instruction uses the py shortcut, which can be set when installing Python on Windows 10. If you do not have this option set, use the full word python instead.

(!) If you already have virtualenv installed, skip that one line below.

$ py -m pip install virtualenv
$ py -m virtualenv env
$ source env/Scripts/activate
$ git checkout develop
$ py -m pip install -r requirements.txt

Set local variables for development environment

To configure the application with environment variables, add the file .env in the project root and paste the following into it:

FLASK_ENV=development
FLASK_DEBUG=True
APP_SETTINGS=config.DevelopmentConfig
DATABASE_URL=postgresql://postgres:password@localhost/ktonadaje_dev

You can read more about connection URI format (the last line in this code snippet above) here.

Create local dev database

Create new database with tiping into SQL Shell (psql):

CREATE DATABASE ktonadaje_dev;
\q

And then (into Git Bash) apply the database structure to your database:

$ py manage.py db upgrade

Check it out!

Finally, check that the project works:

$ py app.py

And, optionally, you can also insert sample data into your database. Just use the already prepared script:

$ py insert_sample_data_dev_db.py

Features

List of features ready and TODOs for future development

  • Displaying table with events

To-do list:

  • Adding events via the form
  • Register and login users
  • Sorting table contents

Status

Project is: in progress

Contact

Created by @BINA.work:

Feel free to contact us!

About

Python | Flask | PostgreSQL | Bootstrap | Livestream and videochat aggregator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published