Skip to content

Quick start (en)

Alexandrov Roman edited this page Jun 24, 2020 · 3 revisions

Quick start

Install git (skip if installed)

Windows

  1. download the appropriate version https://git-scm.com/download/win
  2. Run installer

Linux (Debian & Ubuntu)

sudo apt install git

Clone project

git clone https://github.com/AlexandrovRoman/FlaskBasic.git ./FlaskBasic


Install latest python3 (skip if installed)

Windows

  1. Download latest installer: https://www.python.org/downloads/windows/
  2. Run the installer with the "Add python to path" flag

Linux (Debian & Ubuntu)

  1. wget https://www.python.org/ftp/python/3.{latest version}/Python-3.{latest version}.tgz
  2. tar -xvf Python-{latest version}.tgz
  3. cd Python-{latest version}
  4. ./configure 6.0. sudo apt install zlib1g-dev
  5. sudo make
  6. sudo make install

Create virtual environment

Windows

  1. cd .\FlaskBasic
  2. python -m venv venv

Linux (Debian & Ubuntu)

  1. cd ../FlaskBasic
  2. python3 -m venv venv

Install requirements

Windows

  1. venv\Scripts\activate.bat
  2. pip3 install -r requirements.txt

Linux (Debian & Ubuntu)

  1. source venv/bin/activate
  2. pip3 install -r requirements.txt

Install PostgreSQL

Windows

  1. Download latest installer: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
  2. Run the installer with the all flags For more information, see the https://www.guru99.com/download-install-postgresql.html

Linux (Debian & Ubuntu)

  1. sudo apt-get update
  2. sudo apt-get install postgresql postgresql-contrib For more information, see the https://linuxize.com/post/how-to-install-postgresql-on-ubuntu-18-04/

Install test models to db

  1. Set environment vars (see below)

Windows

  1. venv\Scripts\activate.bat
  2. flask db upgrade

Linux (Debian & Ubuntu)

  1. python3 prepare_db.py

Run server

Windows

python manage.py runserver

Linux (Debian & Ubuntu)

python3 manage.py runserver


Environment variables

Variable Short description Default
HOST Server host 127.0.0.1
PORT Server port 5000
DB_USERNAME PostgreSQL user postgres
DB_URL PostgreSQL server url (host:port) localhost:5432
DB_NAME PostgreSQL database PFRProject
DB_PASSWORD PostgreSQL user password None
EMAIL_SENDER_PASSWORD Service email password None
SECRET_KEY Flask session secret key.
Change in production server
zxczxasdsad
WTF_CSRF_SECRET_KEY WTForms csrf key.
Change in production server
dsofpkoasodksap
SECURITY_PASSWORD_SALT itsdangerous secret key.
Change in production server
iufsdivdjkvcbadb
JWT_SECRET_KEY JWT generator secret key.
Change in production server
cdrrftpocfpreio