B&B is a book recommendation and exchange platform for everyone.
It is being developed as a Minor Project be me, Antriksh Narang and Arjun Nambiar
(Skip this step if you are not working on the ML part of the project)
- Download Miniconda for Python 3.9 bash script here
- Grant execution permissions using:
sudo chmod u+x Miniconda3-py39_23.5.2-0-Linux-x86_64.sh
- Install Miniconda 3 using:
./Miniconda3-py39_23.5.2-0-Linux-x86_64.sh
- Continue the default installation process until "Thank you for installing Miniconda3!" message is obtained.
- Once the installation completes, the following commands register conda as a new command to the default bash script (bashrc file)
source ~/.bashrc
conda config --set auto_activate_base false
source ~/.bashrc
- Download Miniconda for Python 3.9 .exe file from here
- Follow standard installation procedure
- Create a new environment installing the dependencies from the yml file:
conda env create -f requirements.yml --prefix /path/to/venv
- List all environments - some with names, some with only path:
conda env list
- Activates the said environment:
conda activate /path/to/venv
- (OPTIONAL) Enable to open directories using the jupyter-notebook or jupyter-lab server:
python -m ipykernel install --user [--name=<ENV_NAME>] [--prefix=/path/to/venv]
conda env list
- Lists available environmentsconda activate /path/to/venv
- Activates the environment env_name- Run project related commands/scripts.
conda deactivate
- Deactivates the environment
- Requirements are installed while creating the environment
conda env create -f requirements_conda.yml --prefix ./.venv
- Activate the conda environment.
- conda should have installed pip requirements from requirements_conda_pip.txt file. But sometimes torch fails to install during the enviroment set up. In that case run
pip install -r requirements_conda_pip.txt
- Run any suitable commands/scripts.
- Deactivate the conda environment.
- Run this outside any environments to download pipenv:
pip install pipenv
. This shall be the dependency manager for all python projects. Here we are using it to manage flask and its dependencies. - Navigate to the backend's root directory from the project's root directory:
cd ./backend
- Run the following to install all production and development dependencies from the Pipfile Pipenv reference:
pipenv install
pipenv install --dev
- Run the shell in the environment created by pipenv using
pipenv shell
- Run all Flask related commands here.
- Exit the shell (ie. the environment) using the command
exit
- Navigate to the root directory of the backend:
cd ./backend
- Add a .env file as per the .env.example file in this directory.
- Create a .secrets folder and add your
client_secret.json
file. - Run the app using
flask run -p 3000 # if FLASK_ENV="bnb" is listed in .env file
flask --app bnb run [--debug] -p 3000 # Otherwise
- Run
flask db init
for initialization of themigrations/
directory (only once) - Use the following two commands to make migrations and upgrade the database to those changes (every time the schema changes):
flask db migrate # for creating a migration in ./migrations/versions
flask db upgrade # to actually upgrade the database