Django REST API with React App step-by-step

I use PyCharm for python projects and pipenv for package management. Start new PyCharm project named django-rest-react-blog Optionally git init clone gist .gitignore for Django and React projects Main course pipenv install django pipenv install djangorestframework pipenv install ipython --dev django-admin.py startproject bookcase cd bookcase python manage.py startapp mainapp Edit bookcase/settings.py: ... INSTALLED_APPS = [ ... 'rest_framework' ] ... TEMPLATES = [ { ... 'DIRS': [BASE_DIR / 'mainapp-ui/build'], ... }, ] ... STATIC_ROOT = BASE_DIR / 'static' STATICFILES_DIRS = ( (BASE_DIR / 'mainapp-ui/build/static'), ) Edit mainapp/views.py: from django.shortcuts import render def index(request): return render(request, 'index.html', {}) Edit bookcase/urls.py: ... from mainapp.views import index urlpatterns = [ ... path('', index) ] make dir mainapp/api with files there: ...

<span title='2021-02-27 00:00:00 +0000 UTC'>February 27, 2021</span>