-
Notifications
You must be signed in to change notification settings - Fork 3
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.
- Move to 'CLIxDashboard' directory and Start postgres db service from 'docker-compose.yml' file. Use 'docker-compose up db_postgres' command
- 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)
- Create folder 'SchoolImages' in the root directory
- 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'
- (step in case we are resetting already existing postgres db) Remove migrations and pg_data folders using sudo privilages, if they already exist.
- Open 'config.py' in the root directory. Update the following fields: POSTRES_USER, POSTGRES_PASSWORD, POSTGRES_PORT and SQLALCHEMY_DATABASE_URI
- Initialize db using 'flask db init'
- Migrate db structure from flask to postgres db using 'flask db migrate'
- Apply migrations to the db using 'flask db upgrade'
- 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.