Skip to content

Commit a9abf12

Browse files
committed
Commit 10
1 parent 55f7177 commit a9abf12

File tree

6 files changed

+65
-3
lines changed

6 files changed

+65
-3
lines changed

server/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM python:3.12.0-slim-bookworm
2+
3+
ENV PYTHONBUFFERED 1
4+
ENV PYTHONWRITEBYTECODE 1
5+
6+
ENV APP=/app
7+
8+
# Change the workdir.
9+
WORKDIR $APP
10+
11+
# Install the requirements
12+
COPY requirements.txt $APP
13+
14+
RUN pip3 install -r requirements.txt
15+
16+
# Copy the rest of the files
17+
COPY . $APP
18+
19+
EXPOSE 8000
20+
21+
RUN chmod +x /app/entrypoint.sh
22+
23+
ENTRYPOINT ["/bin/bash","/app/entrypoint.sh"]
24+
25+
CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "djangoproj.wsgi"]

server/deployment.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
run: dealership
6+
name: dealership
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
run: dealership
12+
strategy:
13+
rollingUpdate:
14+
maxSurge: 25%
15+
maxUnavailable: 25%
16+
type: RollingUpdate
17+
template:
18+
metadata:
19+
labels:
20+
run: dealership
21+
spec:
22+
containers:
23+
- image: us.icr.io/sn-labs-psoldev9/dealership:latest
24+
imagePullPolicy: Always
25+
name: dealership
26+
ports:
27+
- containerPort: 8000
28+
protocol: TCP
29+
restartPolicy: Always

server/djangoapp/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
backend_url=https://psoldev9-3030.theiadockernext-1-labs-prod-theiak8s-4-tor01.proxy.cognitiveclass.ai
2-
sentiment_analyzer_url=https://sentianalyzer.1sn5job4gm3l.us-south.codeengine.appdomain.cloud
2+
sentiment_analyzer_url=https://sentianalyzer.1snjhiwy65lt.us-south.codeengine.appdomain.cloud

server/entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
# Make migrations and migrate the database.
4+
echo "Making migrations and migrating the database. "
5+
python manage.py makemigrations --noinput
6+
python manage.py migrate --noinput
7+
python manage.py collectstatic --noinput
8+
exec "$@"

server/frontend/src/components/Login/Login.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Login = ({ onClose }) => {
99
const [password, setPassword] = useState("");
1010
const [open,setOpen] = useState(true)
1111

12-
let login_url = window.location.origin+"/djangoapp/login";
12+
let login_url = window.location.origin+"/djangoapp/login/";
1313

1414
const login = async (e) => {
1515
e.preventDefault();

server/frontend/src/components/Register/Register.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Register = () => {
2121
const register = async (e) => {
2222
e.preventDefault();
2323

24-
let register_url = window.location.origin+"/djangoapp/register";
24+
let register_url = window.location.origin+"/djangoapp/register/";
2525

2626
const res = await fetch(register_url, {
2727
method: "POST",

0 commit comments

Comments
 (0)