Bookie-Map core is the backend of Bookie, a Peer to Peer Book Loan App.
BookieMap is written in Python 3 and Flask 2.0.1.
Please install these packages and set up your environment in the order listed below. Run an upgrade or update if you find that the package is already installed:
-
Python 3. Run the 'python3 -V' command to see the version you have installed.
-
Ensure you have python version >= 3.8+ installed.
-
Using VS Code as our text editor: right click on the folder explorer and open a terminal
-
create and activate your virtual environment
python -m venv <envname>
source <envname>/bin/activate
- Install the requirements.
pip install -r requirements.txt
That is all, you have successfully created your own virtual environment. Now you can run Python (see above) and start working on your project.
Please install and set up the following packages first. Upgrade if you find the package is already installed:
-
Download Python3. It is advisable to install the python package as an administrator. Click on the 'Add path' checkbox before moving on to the next step of the installation process. Run this command in your terminal to see the version you have installed.
python3 -V
-
Download pip and follow the instructions in the link as an installation guide.
-
Create virtual environment. You could use any virtualenv package of your choice but for Windows, install this virtual environment wrapper:
python -m pip install virtualenvwrapper-win
-
Create a new virtual environment:
mkvirtualenv <envname>
-
Activate the virtual environment with:
workon <envname>
-
Install requirements in the virtual environment created:
pip install -r requirements.txt
-
Install PostgreSQL.
-
Create a database with PostgresQL, the installation instructions for Fedora can be found here. Make sure to note Database name, Database Username and Password and also ensure that the server is running
-
Create a .env file in the root directory of the project and copy the content of .env.example file to it. Other values not listed below but present in the .env.example file should also be replaced with your own values in your
.env
file. -
Replace
DATABASE_URL
with your database connection string.\ -
Run migrations command to create the tables in heroku after deployment.
flask create_tables
-
Seed data generation. This will generate some data on your local postgresql database for testing purposes. The argument
NUMBER
indicates the amount of seed data to be generated.NUMBER = 1
will generate 2 User profiles (1 Borrower and 1 Lender), 2 Books (the first Book is borrowed, while second Book is available for loan). This command will also generate seed data on your heroku database if you execute this command on heroku's console.
Note: The database need to be have been created and theDATABASE_URL
environment variable is set in your .env file.flask generate_data [NUMBER]
-
Run server to ensure everything is running properly.
flask run
-
Refer to the API documentation
- TBD
- The following may serve as a guide:
- Python - Server Environment
- Flask - Server Framework
- PostgreSQL - Database
- GitHub Actions - CI/CD
- Heroku - Deployment
-
You need to have PostgresQL installed and set up on your machine.
-
Clone the repository from the
staging
branch and please read the contributing guide. -
Update your environment variables by remaning the environment variables file from
.env.example
to.env
and provide entries for the environment placeholders in the.env
file. -
To run the testcases covering various functionalities, run the following command in terminal
python -m unittest -v
Contact Toßin for more details.
This project is licensed under the MIT License - see the LICENSE file for more details.