https://github.com/vyahello/quotes
📋 Web app to reflect famous quotes (django, pytest, docker, k8s, heroku, travisCI)
https://github.com/vyahello/quotes
django fullstack quotes quotes-application web-application
Last synced: about 1 year ago
JSON representation
📋 Web app to reflect famous quotes (django, pytest, docker, k8s, heroku, travisCI)
- Host: GitHub
- URL: https://github.com/vyahello/quotes
- Owner: vyahello
- License: mit
- Created: 2020-03-27T12:48:53.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-26T09:05:45.000Z (about 2 years ago)
- Last Synced: 2025-03-27T08:45:12.064Z (about 1 year ago)
- Topics: django, fullstack, quotes, quotes-application, web-application
- Language: Python
- Homepage: https://quote-quote.herokuapp.com
- Size: 12.6 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README

[](https://www.python.org/)
[](https://travis-ci.org/vyahello/quotes)
[](https://github.com/psf/black)
[](https://www.pylint.org)
[](http://flake8.pycqa.org/)
[](http://www.pydocstyle.org/)
[](http://mypy-lang.org/)
[](LICENSE.md)
[](https://www.elegantobjects.org)
[](https://www.codefactor.io/repository/github/vyahello/quotes)
[](https://hub.docker.com/repository/docker/vyahello/quotes)
[](https://quote-quote.herokuapp.com)
# Quotes
> 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._
## Tools
### Production
- front-end
- html5
- css3
- back-end
- python 3.7, 3.8
- [django](https://www.djangoproject.com/) web framework
- [docker](https://www.docker.com/) >= 18.0
- [k8s](https://kubernetes.io/) >= 1.21.1
### Development
- [pytest](https://pypi.org/project/pytest/)
- [black](https://black.readthedocs.io/en/stable/)
- [mypy](http://mypy.readthedocs.io/en/latest)
- [pylint](https://www.pylint.org/)
- [flake8](http://flake8.pycqa.org/en/latest/)
- [pydocstyle](https://github.com/PyCQA/pydocstyle)
- [travis](https://travis-ci.org/)
## Usage

### Quick start
Please discover app via:
- https://quote-quote.herokuapp.com (prod stage)
- http://178.62.222.165:5003 (test stage)
### Docker
```bash
docker run --rm -it -p 3000:5001 vyahello/quotes: quotes
```
> Please access an application via http://0.0.0.0:3000 endpoint
### K8S
```bash
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
### Source code
```bash
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
**[⬆ back to top](#quotes)**
## Development notes
### REST API
Rest api is build with `djangorestframework` and `drf-yasg` (swagger) libraries.
Here are available api endpoints:
- `/api`:
- `GET`: _Retrieves all quotes_
- `POST`: _Creates a new quote_
- `/api/`:
- `GET`: _Retrieves a single quote by it's id_
- `PUT`: _Updates a single quote by it's id_
- `DELETE`: _Deletes a quote by it's id_
> Please refer to `/api/docs` endpoint which provides a neat swagger REST API documentation.
### Setup
> Please use it as a reference to create/manage fresh django application
```bash
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.
### Docker
Please use the following [example notes](https://github.com/vyahello/quotes#development-notes) to proceed with docker image provisioning.
### K8S
It is possible to orchestrate app via kubernetes, the following command will launch 3 instances of app.
```bash
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
```
### Testing
Generally, `pytest` tool is used to organize testing procedure.
Please follow next command to run only **unit** tests:
```bash
pytest -m unit
```
Or only **api** tests:
```bash
pytest -m api
```
Or only **web** tests, eventually:
```bash
pytest -m web
```
### CI
Project has Travis CI integration using [.travis.yml](.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:
```bash
./analyse-source-code.sh
```
### Release notes
Please check [changelog](CHANGELOG.md) file to get more details about actual versions and it's release notes.
### Meta
Author – _Volodymyr Yahello_. Please check [authors](AUTHORS.md) file for more details.
Distributed under the `MIT` license. See [license](LICENSE.md) for more information.
You can reach out me at:
* [vyahello@gmail.com](vyahello@gmail.com)
* [https://twitter.com/vyahello](https://twitter.com/vyahello)
* [https://www.linkedin.com/in/volodymyr-yahello-821746127](https://www.linkedin.com/in/volodymyr-yahello-821746127)
### Contributing
I would highly appreciate any contribution and support. If you are interested to add your ideas into project please follow next simple steps:
1. Clone the repository
2. Configure `git` for the first time after cloning with your `name` and `email`
3. `pip install -r requirements.txt` to install all project dependencies
4. `pip install -r requirements-dev.txt` to install all development project dependencies
5. Create your feature branch (git checkout -b feature/fooBar)
6. Commit your changes (git commit -am 'Add some fooBar')
7. Push to the branch (git push origin feature/fooBar)
8. Create a new Pull Request
### What's next
All recent activities and ideas are described at project [issues](https://github.com/vyahello/quotes/issues) page.
If you have ideas you want to change/implement please do not hesitate and create an issue.
**[⬆ back to top](#quotes)**