File tree 10 files changed +75
-2
lines changed
10 files changed +75
-2
lines changed Original file line number Diff line number Diff line change 1
1
.github
2
2
venv
3
3
logs
4
+ celerybeat-schedule
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ EMAIL_PORT=2525
10
10
EMAIL_USER = ' 6961971ab353c6'
11
11
EMAIL_PASSWORD = ' 0b78caeeae6e9c'
12
12
REDIS_LOCATION = ' redis://localhost:6379'
13
+ ALLOWED_HOSTS = ' http://localhost.com, https://django.tejasureddy.com'
13
14
14
15
# docker
15
16
POSTGRES_HOST = ' postgres'
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ __pycache__
4
4
assets /*
5
5
! assets /public /
6
6
logs
7
+ celerybeat-schedule
Original file line number Diff line number Diff line change @@ -13,3 +13,6 @@ RUN pip install --no-cache-dir -r requirements.txt
13
13
14
14
# Copy the rest of the application code
15
15
COPY . /app/
16
+
17
+ RUN mkdir /app/logs
18
+ RUN touch /app/logs/django.log
Original file line number Diff line number Diff line change
1
+ version : ' 3'
2
+
3
+ services :
4
+ postgres :
5
+ image : postgres
6
+ restart : always
7
+ env_file :
8
+ - .env
9
+
10
+ redis :
11
+ image : redis
12
+ ports :
13
+ - " 6379:6379"
14
+ restart : always
15
+
16
+ django :
17
+ build :
18
+ context : .
19
+ dockerfile : Dockerfile
20
+ command : >
21
+ sh -c "python manage.py migrate && gunicorn my_project.wsgi:application --bind 0.0.0.0:8000 && celery -A my_project worker -l info -P gevent && celery -A my_project beat -l info"
22
+ expose :
23
+ - 8000
24
+ volumes :
25
+ - static_volume:/app/static/
26
+ env_file :
27
+ - .env
28
+ depends_on :
29
+ - postgres
30
+ - redis
31
+
32
+ nginx :
33
+ build : ./nginx
34
+ ports :
35
+ - 80:80
36
+ volumes :
37
+ - static_volume:/app/static/
38
+ depends_on :
39
+ - django
40
+
41
+ volumes :
42
+ static_volume :
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ services:
18
18
context : .
19
19
dockerfile : Dockerfile
20
20
command : >
21
- sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000 & celery -A my_project worker -l info -P gevent & celery -A my_project beat -l info"
21
+ sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000 && celery -A my_project worker -l info -P gevent & & celery -A my_project beat -l info"
22
22
ports :
23
23
- " 8000:8000"
24
24
volumes :
Original file line number Diff line number Diff line change 31
31
# SECURITY WARNING: don't run with debug turned on in production!
32
32
DEBUG = env .bool ("DEBUG" , False )
33
33
34
- ALLOWED_HOSTS = []
34
+ ALLOWED_HOSTS = env .list ("ALLOWED_HOSTS" )
35
+
36
+ CSRF_TRUSTED_ORIGINS = env .list ("ALLOWED_HOSTS" )
35
37
36
38
INTERNAL_IPS = ["127.0.0.1" ]
37
39
Original file line number Diff line number Diff line change
1
+ FROM nginx:1.25
2
+ RUN rm /etc/nginx/conf.d/default.conf
3
+ COPY nginx.conf /etc/nginx/conf.d
Original file line number Diff line number Diff line change
1
+ upstream my_project {
2
+ server django:8000;
3
+ }
4
+
5
+ server {
6
+ listen 80 ;
7
+
8
+ location / {
9
+ proxy_pass http://my_project;
10
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
11
+ proxy_set_header Host $host ;
12
+ proxy_redirect off ;
13
+ }
14
+
15
+ location /static/ {
16
+ alias /app/static/;
17
+ }
18
+ }
Original file line number Diff line number Diff line change @@ -29,3 +29,5 @@ ruff==0.3.5 # linter and code formatter
29
29
coverage == 7.4.4 # code coverage testing
30
30
djlint == 1.34.1 # html template linter and formatter
31
31
django-csp == 3.8 # security - which resources can be loaded on a web page
32
+ gunicorn == 21.2.0 # for deployment
33
+ psycopg2-binary == 2.9.6 # for postgres
You can’t perform that action at this time.
0 commit comments