Make sure project folder has been created saas-boilerplate
and you already created a backend
folder inside of it.
- Open up a new terminal shell along side your currently running Django server.
- Go the root of the project folder i.e.
Desktop/saas-boilerplate
from stepbackend
setup that you created by runningcd ~/Desktop/saas-boilerplate
or where ever you created your main project folder withbackend
inside.- run
mkdir frontend
,cd frontend
andgit clone https://github.com/rcmiskin10/dj_react_frontend_render_template.git .
- make sure you have
npm
and runnpm install
. - Now create a
.env
insidefrontend
root folder.- Add the publishable key from Stripe to the environmental variable
REACT_APP_STRIPE_API_TEST_PK
with the value fromSTRIPE_API_TEST_PK
inbackend/.env
in step 12.3.1. - Now add an environmental variable
REACT_APP_GA_ID
for Google Analytics- Go to https://analytics.google.com/
- Add an analytics account
- Add an app
- Go to top search bar and search for
MEASUREMENT ID
inData Streams
and copy the ID that has prefixG-XXXXXXXX
- Past that
G-XXXXXXXX
as value for environmental variableREACT_APP_GA_ID
infrontend/.env
- Go to https://analytics.google.com/
- Add the publishable key from Stripe to the environmental variable
- Once complete run
npm run start
. - Once up and running you should be able to go to http://localhost:3000/ where you should see all the data you added for landing page in django
- run
- Now everything in dev should be up and running.
- Next we will deploy the
frontend/
app (static react app) to render.com.- Create a repo on your github for the
frontend
folder - Connect your github account here: https://dashboard.render.com/select-repo?type=static
- Follow the instructions to deploy
- Once deployed go to settings for frontend app
- In Redirect/Rewrite rules add:
/*
as Source/index.html
as Destination- And
Rewrite
as Action
- In Redirect/Rewrite rules add:
- Now go to
Environment
and add:REACT_APP_STRIPE_API_TEST_PK
to same Stripe API Key that you set in backend- Add
REACT_APP_BACKEND_API_URL
and use the backend url from above after backend was deployed - Add your
REACT_APP_MEDIA_URL
to the Cloudinary url. Something like thishttps://res.cloudinary.com/xxxxxxx/image/upload/v1/
Thexxxxxxx
should be found in your cloudinary dashboard that you used in backend set up. - Now add
REACT_APP_GA_ID
from your .envREACT_APP_GA_ID
in local file. - Finally take the Frontend url from the react frontend app and set it in the
backend app
on render.com's environmental variableFRONTEND_URL
that you previously set up.
- Create a repo on your github for the