https://github.com/fandredev/django-api-rest
Basic API rest from students, courses and Matriculations using Python and Django Rest Framework
https://github.com/fandredev/django-api-rest
alura black django drf postgresql python
Last synced: 3 months ago
JSON representation
Basic API rest from students, courses and Matriculations using Python and Django Rest Framework
- Host: GitHub
- URL: https://github.com/fandredev/django-api-rest
- Owner: fandredev
- Created: 2024-05-18T19:24:52.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T14:37:28.000Z (about 2 years ago)
- Last Synced: 2024-05-22T16:34:12.679Z (about 2 years ago)
- Topics: alura, black, django, drf, postgresql, python
- Language: Python
- Homepage:
- Size: 54.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Stack used

**Lint:** Black
**CI/CD:** Github Actions
## Authors
- [@fandredev](https://www.linkedin.com/in/devfandre/)
- [Alura](https://cursos.alura.com.br/formacao-django-rest)
# Installation:
## First, clone this repository.
```bash
git clone git@github.com:fandredev/django-api-rest.git
```
## Create virtual environment with Python
```bash
python -m venv venv
```
## OR
```bash
python3 -m venv venv
```
## Activate the virtual environment
```bash
source venv/bin/activate
```
## Install dependencies using pip
```bash
pip install -r requirements.txt
```
- Look the .env.example file to change your informations from PostgreSQL database.
A database must be created using PostgreSQL manually and your server needs be a running in other terminal.
In example, i use asdf to instance postgres in my machine. (https://asdf-vm.com/)


## Run migrations to database
```bash
python manage.py migrate
```
## Create a superuser
```bash
python manage.py createsuperuser
```
## Run development server
```bash
python manage.py runserver
```
- or using ```launch.json``` file (if you use vscode)
## Run tests
```bash
python manage.py test
```
## Open Django Admin
In another tab, open browser and put http://localhost:8000/control in URL browser. Log in with your superuser
## OPTIONAL (Populate your database using faker data)
```
python populate_students.py && python populate_courses.py
```
## Use collection
Use DRF.postman_collection.json file to use Django Rest Framework routes

- Pass, the user and password authorization to using routes (super/password that were created with ```python manage.py createsuperuser```)

- by default, the answers will come in .xml; Change this using 'Accept' header with 'application/json' value.

- Note: to use students routes v2 use, http://localhost:8000/students?version=v2
## Feedback
If you have any feedback, please let us know via profissionalf.andre@gmail.com
## Referencies
- [Django documentation](https://docs.djangoproject.com/en/5.0/)
- [Python](https://www.python.org/)
- [Black formatter](https://black.readthedocs.io/en/stable/the_black_code_style/index.html)
- [Alura Training](https://cursos.alura.com.br/formacao-django-rest)