- Notifications
You must be signed in to change notification settings - Fork70
API for sunnah.com
sunnah-com/api
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The official API of sunnah.com for retrieving information about hadith collections.
Please follow the instructions below.
First create a local.env.local
configuration file and update values as needed.A sample file is provided at.env.local.sample
.
Run manually:
git clone REPOcd REPOpython3 -m venv venvsource venv/bin/activatepip install -r requirements.txtexport FLASK_ENV=development FLASK_APP=main.pyflask run --host=0.0.0.0
Or alternatively usedocker-compose
which will give a full environment with a MySQL instance loaded with a sample dataset:
docker-compose up
- Use
--build
option to re-build. - Use the
-d
option to run in detached mode.
You can then visitlocalhost:5000 to verify that it's running on your machine. Or, alternatively:
$ curl http://localhost:5000
Configuration files are located atenv.local
anduwsgi.ini
.
A production ready uWSGI daemon (uwsgi socket exposed on port 5001) can be started with:
docker-compose -f docker-compose.prod.yml up -d --build
Visithttps://sunnah.stoplight.io/docs/api/ for full API documentation.
flake8
andblack
are used for code linting and formatting respectively. Before submitting pull requests, make sure black and flake8 is run against the code. Follow the instructions below for usingblack
andflake8
:
# goto repository root directory# make sure the virtual environment is activatedblack.flake8.# fix any linting issues# Then you are ready to submit your PR
To add more rules for linting and formatting, make changes to.flake8
andpyproject.toml
accordingly.
- Only change one thing at a time.
- Don't mix a lot of formatting changes with logic change in the same pull request.
- Keep code refactor and logic change in separate pull requests.
- Squash your commits. When you address feedback, squash it as well. No one benefits from "addressed feedback" commit in the history.
- Break down bigger changes into smaller separate pull requests.
- If changing UI, attach a screenshot of how the changes look.
- Reference the issue being fixed by adding the issue tag in the commit message.
- Do not send a big change before first proposing it and getting a buy-in from the maintainer.