This project is simple API.
This documentation shows how to install the development enviroment. This is Python3 and Django based project.
- Python3
- Django
- Django Rest framework
This may differ between Linux and MacOs platform. So take a look on these links:
- Python3 - Script programming language
- Pip3 - Package manager for python
- git - Source code version manager
If the Python2 is installed it will conflict with Python3, so you should create a virutal enviroment.
Create a folder to be the working directory and execute a git clone. If you don't have access or user, contact the Administrator.
#SSH
git@github.com:rrgaya/review-api.git
# HTTP
https://github.com/rrgaya/review-api.gitAccess the folder created by git on the terminal shell and you must run the following command, where env is the name of the base directory for pip3 will install all project library without conflict or affect the machine libraries. Also will assure that only python3 will be running in the virtual environment.
$ python3 -m venv venvRun this commmand in the same folder where the env folder is located.
$ source env/bin/activate
It's a good practice upgrade pip for the first time
$ pip3 install pip --upgrade
For the sake of simplicity all the requirements are in the file requirementes.txt
$ pip3 install -r requirements.txtEvery time you need to start the development enviroment to programming or test follow the step:
- Activate the virutal env
$ source venv/bin/activate- To starting the project run this command.
$ python manage.py runserver- To run the test, execute:
$ pytest- To run the test with coverage, execute:
$ pytest --cov$ http :8000/token/ username="" password="" Response:
HTTP/1.1 200 OK
Allow: POST, OPTIONS
Content-Length: 52
Content-Type: application/json
Date: Mon, 18 Nov 2019 18:01:03 GMT
Server: WSGIServer/0.2 CPython/3.7.5
X-Frame-Options: SAMEORIGIN
{
"token": "a8011880f073443f75dfe3e6bf7d1ff49c4fe3be"
}Ignore this Token, because this is example. Get the your Token.
$ http :8000/api/ "Authorization:Token a8011880f073443f75dfe3e6bf7d1ff49c4fe3be"$ http POST :8000/api/post/ "Authorization:Token ac93c31f0ca3e758479520084dc1e8f3e4e41c4e" \
company=1 \
rating=5 \
sumary="Sumary Example" \
title="Title Example" \User: admin
Pass: 2019@252