Simple web application to show quotes of famous people.
It is built with django python web framework.
Note: please take into account that it is built for demo purpose but not for actual usage.
Please discover app via:
- https://quote-quote.herokuapp.com (prod stage)
- http://178.62.222.165:5003 (test stage)
docker run --rm -it -p 3000:5001 vyahello/quotes:<version> quotes
Please access an application via http://0.0.0.0:3000 endpoint
kubectl create deployment quotes --image=vyahello/quotes
kubectl expose deployment quotes --type=LoadBalancer --port=3000
Please access an application via http://0.0.0.0:3000 endpoint
git clone git@github.com:vyahello/quotes.git
cd quotes
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
python quotes/manage.py runserver
Please access an application via http://127.0.0.1:8000 endpoint
Rest api is build with djangorestframework
and drf-yasg
(swagger) libraries.
Here are available api endpoints:
/api
:GET
: Retrieves all quotesPOST
: Creates a new quote
/api/<id>
:GET
: Retrieves a single quote by it's idPUT
: Updates a single quote by it's idDELETE
: Deletes a quote by it's id
Please refer to
/api/docs
endpoint which provides a neat swagger REST API documentation.
Please use it as a reference to create/manage fresh django application
django-admin startproject manager # create application manager
django-admin startapp app # create application source
python quotes/manage.py makemigrations # add new model (if exists) to database
python quotes/manage.py migrate # sync models with database
python quotes/manage.py shell # start interactive shell
python quotes/manage.py createsuperuser # create user for administration
To manage an application please use /admin
endpoint.
Please use admin
superuser for management.
Please use the following example notes to proceed with docker image provisioning.
It is possible to orchestrate app via kubernetes, the following command will launch 3 instances of app.
kubectl apply -f k8s/deployment.yaml
kubectl get pods
NAME READY STATUS RESTARTS AGE
quotes-6f64474dc5-7ct8t 1/1 Running 0 4m49s
quotes-6f64474dc5-95cx8 1/1 Running 0 4m49s
quotes-6f64474dc5-dg5n8 1/1 Running 0 4m49s
Generally, pytest
tool is used to organize testing procedure.
Please follow next command to run only unit tests:
pytest -m unit
Or only api tests:
pytest -m api
Or only web tests, eventually:
pytest -m web
Project has Travis CI integration using .travis.yml file thus code analysis (black
, pylint
, flake8
, mypy
, pydocstyle
) and unittests (pytest
) will be run automatically after every made change to the repository.
To be able to run code analysis, please execute command below:
./analyse-source-code.sh
Please check changelog file to get more details about actual versions and it's release notes.
Author β Volodymyr Yahello. Please check authors file for more details.
Distributed under the MIT
license. See license for more information.
You can reach out me at:
- vyahello@gmail.com
- https://twitter.com/vyahello
- https://www.linkedin.com/in/volodymyr-yahello-821746127
I would highly appreciate any contribution and support. If you are interested to add your ideas into project please follow next simple steps:
- Clone the repository
- Configure
git
for the first time after cloning with yourname
andemail
pip install -r requirements.txt
to install all project dependenciespip install -r requirements-dev.txt
to install all development project dependencies- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request
All recent activities and ideas are described at project issues page. If you have ideas you want to change/implement please do not hesitate and create an issue.