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:
|
volumes:
|
||||||
- ./frontend:/app
|
- ./frontend:/app
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
command: sh -c "npm install; npm start"
|
command: sh -c "npm install; npm start"
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
|
@ -51,5 +53,6 @@ services:
|
||||||
- frontend
|
- frontend
|
||||||
volumes:
|
volumes:
|
||||||
- ./nginx.conf:/etc/nginx/nginx.conf
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
- ./backend/right_tree/staticfiles:/etc/nginx/html/staticfiles
|
||||||
ports:
|
ports:
|
||||||
- "9000:80"
|
- "9000:80"
|
||||||
|
|
|
@ -2,7 +2,7 @@ import axios from "axios"
|
||||||
|
|
||||||
// Create the axios object
|
// Create the axios object
|
||||||
const repo = axios.create({
|
const repo = axios.create({
|
||||||
baseURL: "/api",
|
baseURL: window.location.hostname == 'localhost' ? "http://localhost:9000/api" : "/api",
|
||||||
});
|
});
|
||||||
|
|
||||||
repo.defaults.headers.post["access-control-allow-origin"] = "*";
|
repo.defaults.headers.post["access-control-allow-origin"] = "*";
|
||||||
|
|
|
@ -8,6 +8,10 @@ http {
|
||||||
proxy_pass http://frontend:3000;
|
proxy_pass http://frontend:3000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /staticfiles {
|
||||||
|
root /etc/nginx/html/;
|
||||||
|
}
|
||||||
|
|
||||||
location ~* ^/(api|admin) {
|
location ~* ^/(api|admin) {
|
||||||
proxy_pass http://backend:8000;
|
proxy_pass http://backend:8000;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue