Skip to content

Setup clix_dashboard_backend

parthasarathiE edited this page Jan 28, 2020 · 9 revisions

Following are the steps involved in setting up backend part of CLIxDashboard.

  1. Move to 'CLIxDashboard' directory and Start postgres db service from 'docker-compose.yml' file. Use 'docker-compose up db_postgres' command
  2. Move into 'clix_dashboard_backend' folder and create a python virtual environment using 'python3 -m venv clix_env' (don't change name of venv, as we will be ignoring it .gitignore list)
  3. Create folder 'SchoolImages' in the root directory
  4. Enter python virtual env using 'source clix_env/bin/activate'. Now from inside the virtual environment install all the modules from requirements.txt using 'pip3 install -r requirements.txt'
  5. (step in case we are resetting already existing postgres db) Remove migrations and pg_data folders using sudo privilages, if they already exist.
  6. Open 'config.py' in the root directory. Update the following fields: POSTRES_USER, POSTGRES_PASSWORD, POSTGRES_PORT and SQLALCHEMY_DATABASE_URI
  7. Initialize db using 'flask db init'
  8. Migrate db structure from flask to postgres db using 'flask db migrate'
  9. Apply migrations to the db using 'flask db upgrade'
  10. Add admin user using clix_dashboard_backend.py script run 'flask create_admin --username admin_clixdata'

11.Our postgres DB is now initialised and you can stop 'db_potgres' service now

Note: After this step, it is best to use '--build' argument when setting up clix_dashboard_backend container. As we may get alembic versioning errors otherwise.

Clone this wiki locally