Skip to content

JhottMaster/djando-react-postgresql-docker-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Getting started

1.) docker-compose build 2.) docker-compose up -d

Troubleshooting

  • Make sure you run commands with the correct permissions. (e.g. may need to sure with sudo)
  • If you're getting a "port is already allocated" error:
    • Make sure services aren't already running. E.g. run docker-compose down
    • Make sure you don't have any other docker containers running that use the port:
      • sudo docker container ls
      • sudo docker stop [CONTAINER ID]

Notes

How I made this:

python3 -m venv .venv
source .venv/bin/activate
pip install django djangorestframework django-cors-headers psycopg2-binary
django-admin startproject backend
pip freeze > requirements.txt
touch gitignore
code gitignore

.venv/
backend/backend/__pycache__/
backend/db.sqlite3

git init
git add .
git commit -m "Backend"

npm create vite@latest frontend --template react-ts

Select:

  • (y)
  • React
  • Typescript + SWC
cd frontend
npm install
npm run dev

Validate it works; Ctrl + C

cd ../
git add .
git commit -m "Front end"

Then I created the actual containerization; see git history.

References

https://dev.to/anjalbam/dockerize-a-django-react-and-postgres-application-with-docker-and-docker-compose-by-anjal-bam-e0a

About

Template for a Python Django API app with PostgreSQL and ReactJS/Vite

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published