Django-Reactjs-Application

Install Python

mkdir lcodev

cd lcodev

pip install pipenv

pipenv shell

pipenv install pytest

pip freeze (to list all installed packages)

pipenv install Django==3.0.8

django-admin startproject ecom

python manage.py runserver

python manage.py makemigrations

python manage.py migrate

python manage.py createsuperuser

rupak/123456

pipenv install django-cors-headers

settings.py -> installed app add these lines:

'corsheaders',

Add middlewares: 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', Add at last CORS_ORIGIN_ALLOW_ALL = True

Add allowed hosts ALLOWED_HOSTS = ['*']

pipenv install djangorestframework

Add settings.py under App_settings
'rest_framework',

'rest_framework.authtoken',  //for custom signup

Copy this at bottom:
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_AUTHENTICATION_CLASSES': [
    'rest_framework.authentication.BasicAuthentication',
    'rest_framework.authentication.SessionAuthentication',
    'rest_framework.authentication.TokenAuthentication',
],
'DEFAULT_PERMISSION_CLASSES': [
    'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}

django-admin startapp api

cd api

django-admin startapp category

pipenv install pillow // for image handling

To add customer super admin

Generated by Django 3.0.8 on 2020-09-27 09:03

payment gateway

pipenv install braintree

Frontend Reactjs

npm install react-router-dom braintree-web-drop-in-react query-string

to solve admin invalid credential issue

For CORS issue

in settings.py file add corsheaders under APPS add corsmiddlewares and this CORS_ORIGIN_WHITELIST ='https://localhost:3000',

signup: rk@gmail.com 1234