Fix development nginx setup
- Expose 3000 for hot reload - Apply conditional for respository base URL - Include static files for django admin
This commit is contained in:
parent
687a256fff
commit
a050f0083e
3 changed files with 8 additions and 1 deletions
|
@ -26,6 +26,8 @@ services:
|
|||
volumes:
|
||||
- ./frontend:/app
|
||||
working_dir: /app
|
||||
ports:
|
||||
- "3000:3000"
|
||||
command: sh -c "npm install; npm start"
|
||||
|
||||
postgres:
|
||||
|
@ -51,5 +53,6 @@ services:
|
|||
- frontend
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./backend/right_tree/staticfiles:/etc/nginx/html/staticfiles
|
||||
ports:
|
||||
- "9000:80"
|
||||
|
|
|
@ -2,7 +2,7 @@ import axios from "axios"
|
|||
|
||||
// Create the axios object
|
||||
const repo = axios.create({
|
||||
baseURL: "/api",
|
||||
baseURL: window.location.hostname == 'localhost' ? "http://localhost:9000/api" : "/api",
|
||||
});
|
||||
|
||||
repo.defaults.headers.post["access-control-allow-origin"] = "*";
|
||||
|
|
|
@ -8,6 +8,10 @@ http {
|
|||
proxy_pass http://frontend:3000;
|
||||
}
|
||||
|
||||
location /staticfiles {
|
||||
root /etc/nginx/html/;
|
||||
}
|
||||
|
||||
location ~* ^/(api|admin) {
|
||||
proxy_pass http://backend:8000;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue