React with server-side rendering and django api on docker
Download the example or clone:
curl https://codeload.github.com/fivethreeo/react-ssr-django-jwt-docker/tar.gz/master | tar -xz react-ssr-django-jwt-docker-master
cd react-ssr-django-jwt-docker-master
Build images:
sudo docker-compose -f docker-compose.dev.yml build
Run database migrations:
touch db.sqlite3
sudo docker-compose -f docker-compose.dev.yml run djangoapi python manage.py migrate
Run all services (traefik, djangoapi, reactapp):
sudo docker-compose -f docker-compose.dev.yml up
export EMAIL_URL=smtp://username:password@localhost:25
sudo -E docker-compose -f docker-compose.dev.yml up
Go to https://github.com/settings/developers and click New Oauth App
.
Set Authorization callback URL
to https://localhost/social/github/complete
.
export SOCIAL_AUTH_GITHUB_KEY="5137xfvkhv44468bca82e88"
export SOCIAL_AUTH_GITHUB_SECRET="23b3yfifvveeeyhvb0c6ce80bb"
sudo -E docker-compose -f docker-compose.dev.yml up
Add more backends to AUTHENTICATION_BACKENDS
in djangoapi/settings.py
.
Add extra SOCIAL_AUTH_[BACKEND]_[SECRET|KEY]
settings in djangoapi/settings.py
.
Go to https://localhost.
To remove https warnings add certs/localhost_https_ca.pem
to authorities in your browser.
To make your own certs:
cd certs
rm localhost_https*
bash makecert.sh --dn-c "US" --dn-st "TX" --dn-l "Houston" \
--dn-o "Your organization" --dn-ou "Your department" \
--dn-email "[email protected]" \
--common-name "localhost" --dns "localhost" --ip "127.0.0.1" --https