Necessários instalar:
- nada
git pull --all
git switch dev
obs.: o requirements.txt só precisa ser usado enquanto a imagem do docker não as tiverem ou estiver instalando localmente
pip install -r requirements.txt
service mysql start
mariadb
Na bash do MariaDB (MariaDB [(none)]>):
CREATE DATABASE apisemglu;
CREATE USER 'administrativo'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON apisemglu.* TO 'administrativo'@'localhost';
FLUSH PRIVILEGES;
Para sair da bash do MariaDB:
exit
Criando as tabelas do projeto: apisemglu
python3 manage.py migrate
Criando as tabelas do aplicativo: semglu
python3 manage.py makemigrations semglu
python3 manage.py migrate
Obs.: esse mesmo processo deve ser feito quando modificar a pasta models.py
Para acessar a database "apisemglu" criada
mariadb
Na bash do MariaDB (MariaDB [(none)]>):
use apisemglu
Iniciando o servidor HTTP (usamos esse método na VM do CIn)
python3 manage.py runserver 0.0.0.0:8000
python3 manage.py createsuperuser
Substitua e pelos criados para o superuser
curl -X POST http://localhost/api/token/ -H 'Content-Type: application/json' -d '{"username":"<usuario>","password":"<senha>"}'
Substitua <token_refresh> pelo recebido no Login
curl -X POST http://localhost/api/token/refresh/ -H 'Content-Type: application/json' -d '{"refresh":"<token_refresh>"}'
Substitua <token_acesso> pelo access token
curl https://localhost:8000/products/ -H 'Authorization: <token_acesso>'