Django and react
- Create a virtual environment using pipenv shell command inside the directory you are
working.
The result will look something like the above image. There will be a pip file inside the
project folder once you create a virtual environment.
- Install the following dependencies that are necessary for the project namely Django,
djangorestframework and Django-rest-knox.
- Create a Django project with django-admin startproject theNameOfTheProject
- Make sure you select the right interpreter on vscode using cmd+shift+p and entering
python will bring select interpreter. Click on it and you will find:
Choose this option, since it has a relation with the project you are working with.
- Then create a Django app using python3 manage.py startapp app_name
- Then add your app inside the settings.py file in the inner ecommerce directory.
- Add rest_framework to the installed_apps list in the above image, since we are also
going to use that.
After the setup,
- Create a model for the app in Django model.py file.
Serializers (we use the Django-rest-api serializers)
- Are used to convert python objects into a datatype that can be understood by frontend
languages like JavaScript and frontend frameworks.