Dica 50 - DRF: Django CORS headers
Github: https://github.com/rg3915/drf-example
https://pt.wikipedia.org/wiki/Cross-origin_resource_sharing
https://github.com/adamchainz/django-cors-headers
python -m pip install django-cors-headers
pip freeze | grep django-cors-headers >> requirements.txtEdite settings.py
CORS_ALLOWED_ORIGINS = [
'http://localhost:8080',
]
INSTALLED_APPS = [
...,
'corsheaders',
...,
]
MIDDLEWARE = [
...,
# corsheaders
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
...,
]
Frontend
Edite router/index.js
touch src/views/Login.vue
PreviousDica 49 - DRF: Autenticação via JWT com djoser - Django REST frameworkNextDica 51 - DRF: paginação
Last updated
Was this helpful?