this project is a Template that utilies pymongo and mongodb as the database
- Python 3.11: This project requires Python 3.11. Make sure you have it installed on your machine.
If you prefer using Pipenv
to manage your virtual environment and dependencies, follow these steps:
-
Install Python 3.11 and Pipenv: Ensure you have Python 3.11 installed and then install
Pipenv
if you haven't already:pip install pipenv
-
Create and Activate the Pipenv Environment: Use the following command to create a Pipenv environment with Python 3.11:
pipenv install --python 3.11
-
Install Dependencies: Once the environment is created, install the dependencies listed in the
requirements.txt
file:pipenv run pip install -r requirements.txt
If you're using pip
directly (without Pipenv), follow these steps:
-
Create a Virtual Environment: Create a virtual environment using Python 3.11:
python3.11 -m venv venv
-
Activate the Virtual Environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install Dependencies: With the virtual environment activated, install the dependencies using
pip
:pip install -r requirements.txt
Make sure you have MongoDB installed and running on your machine. You’ll need to configure your connection settings in the application to connect to your MongoDB instance. Lookup .env.example
as a guide
SERVER_USERNAME=user_name
SERVER_PASSWORD=password
CLUSTER_NAME =your_cluster_name
DB_NAME=your_database_name
SECRET_KEY=Rahasia123!
Once you have installed all dependencies and set up the database, you can run the application:
pipenv run python index.py
or
python index.py
(depending on whether you're using Pipenv
or pip
).
go to the test directory then , run this naming conventions for pytest you can refer to this Documentation
pytest --cov=your_package_name --cov-report=term-missing
example :
pytest --cov=app --cov-report=html
This checks your coverage then print it to html that you can open using quokka or Live server This is the example of the output expected in the html
this template provide documentation using OpenApi's Swagger from the flasgger library
to acess your swagger-UI (view) use acess it through
{{your_base_url}}/apidocs
this is what will you expect from acessing it
- If you're contributing to the project, please make sure to follow the same Python version and environment setup to avoid any compatibility issues.
- Feel free to add more instructions based on your project's specific needs.