This is simple project to get hands on framework Django.
- Python3
-
Clone github repository:
git clone https://github.com/BranislavDubec/Django-rest-api.git cd Django-rest-api/
-
(optional) Create virtual environment:
virtualenv -p python3 env
orpython -m venv env
and activate it
-
Install requirements:
pip install -r requirements.txt
-
Migrate database and run server:
cd apichall/ python manage.py migrate python manage.py runserver
After successfull instalation, the project should be running on localhost on port 8000: http://127.0.0.1:8000/. Functionality can be tested via python manage.py test api. E.g.:
- http://127.0.0.1:8000/countries/?country-code=CZ&limit=500&offset=0
- http://127.0.0.1:8000/countries/?limit=2&offset=3
- http://127.0.0.1:8000/countries
- http://127.0.0.1:8000/countries/2
- http://127.0.0.1:8000/countries/2
- Required name, countryCode, optional groupId
- { "name": "Czechia", "countryCode": "CZ", "groupId": 5 }
- http://127.0.0.1:8000/countries
- Required name, countryCode, optional groupId
- { "name": "Czechia", "countryCode": "CZ", "groupId": 10 }