Django + Nextjs +Tailwind CSS + PostgreSQL
- Activate the dev container in VSCode
- Start the db, server and client with
docker compose up
- Server is at
localhost:8000
, client atlocalhost:3000
If the models are updated, be sure to create a migration:
docker container exec server python manage.py makemigrations # create a new migration OR
dxc server python manage.py makemigrations
If you're in the dev container, this should be done already. You can run poetry install
and npm install
in the correct folders to get the latest dependencies.
If you modify anything in the docker
folder, you need to add the --build
flag or Docker won't give you the latest changes.
Edit the .env
file in the respective directory (client or server).
- make a copy of "./client/.env.example" and rename the copy file to
.env.prod
: - modify the value in
.env.prod
:APP_ENV=PRODUCTION
;NEXT_PUBLIC_BACKEND_URL="http://{YOUR PUBLIC IP ADRESS}:8000/api"
- make a copy of "./server/.env.example" and rename the copy file to
.env.prod
: - modify the value in
.env.prod
:API_ALLOWED_HOSTS=".localhost 127.0.0.1 [::1] {YOUR PUBLIC IP ADRESS}"
and remain the APP_ENV as "DEVELOPMENT"
Change the value of LocalBaseURL
from "http://localhost:8000/api" to "http://{YOUR PUBLIC IP ADRESS}:8000/api"
-- const LocalBaseURL = "http://localhost:8000/api";
++ const LocalBaseURL = "http://{YOUR PUBLIC IP ADRESS}/api";
- delete
./docker-compose.yml
- change the name of file
./docker-compose.prod.yml
to./docker-compose.yml
Run the command below and it will start 3000 port as the frontend port:
docker compose up