Spaces:
Runtime error
Runtime error
Commit
•
d1e5295
1
Parent(s):
5fcf143
docker and django
Browse files- Dockerfile +8 -6
- django.conf +22 -0
- docker-compose.yml +11 -0
Dockerfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# Use an official Python runtime as the base image
|
2 |
-
FROM python:3.
|
3 |
|
4 |
# Set environment variables
|
5 |
ENV NUMBA_DISABLE_JIT=1
|
@@ -9,6 +9,8 @@ ENV PYTHONUNBUFFERED 1
|
|
9 |
# Set the working directory in the container
|
10 |
WORKDIR /app
|
11 |
|
|
|
|
|
12 |
|
13 |
# Install OpenCV dependencies
|
14 |
RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 libxrender-dev libgl1-mesa-glx
|
@@ -20,11 +22,11 @@ COPY requirements.txt .
|
|
20 |
# Install project dependencies
|
21 |
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
-
#
|
24 |
-
|
25 |
|
26 |
# Expose the port your Django app will run on
|
27 |
-
EXPOSE
|
28 |
|
29 |
-
#
|
30 |
-
CMD ["
|
|
|
1 |
# Use an official Python runtime as the base image
|
2 |
+
FROM python:3.8-apache
|
3 |
|
4 |
# Set environment variables
|
5 |
ENV NUMBA_DISABLE_JIT=1
|
|
|
9 |
# Set the working directory in the container
|
10 |
WORKDIR /app
|
11 |
|
12 |
+
# Copy the Django project code into the container
|
13 |
+
COPY . /app
|
14 |
|
15 |
# Install OpenCV dependencies
|
16 |
RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 libxrender-dev libgl1-mesa-glx
|
|
|
22 |
# Install project dependencies
|
23 |
RUN pip install --no-cache-dir -r requirements.txt
|
24 |
|
25 |
+
# Collect static files
|
26 |
+
RUN python manage.py collectstatic --noinput
|
27 |
|
28 |
# Expose the port your Django app will run on
|
29 |
+
EXPOSE 80
|
30 |
|
31 |
+
# Start Apache when the container starts
|
32 |
+
CMD ["apache2-foreground"]
|
django.conf
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<VirtualHost *:80>
|
2 |
+
ServerName passportapi.pythonanywhere.com/
|
3 |
+
|
4 |
+
# Set the location of the WSGI script
|
5 |
+
WSGIScriptAlias / /passportapi/wsgi.py
|
6 |
+
|
7 |
+
# Set additional configurations if needed
|
8 |
+
# ...
|
9 |
+
|
10 |
+
<Directory /passportapi>
|
11 |
+
<Files wsgi.py>
|
12 |
+
Require all granted
|
13 |
+
</Files>
|
14 |
+
</Directory>
|
15 |
+
|
16 |
+
# Set static files location
|
17 |
+
Alias /static /static
|
18 |
+
|
19 |
+
# Set media files location
|
20 |
+
Alias /media /media
|
21 |
+
|
22 |
+
</VirtualHost>
|
docker-compose.yml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: "3"
|
2 |
+
|
3 |
+
services:
|
4 |
+
django:
|
5 |
+
build:
|
6 |
+
context: .
|
7 |
+
dockerfile: Dockerfile
|
8 |
+
ports:
|
9 |
+
- "8000:80"
|
10 |
+
volumes:
|
11 |
+
- .:/app
|