Spaces:
Sleeping
Sleeping
Commit
·
b8414ad
1
Parent(s):
3e924b8
Add static file handling and update Docker CMD for debugging
Browse files- BridgeMentor/settings.py +10 -0
- BridgeMentor/urls.py +8 -6
- Dockerfile +1 -1
BridgeMentor/settings.py
CHANGED
|
@@ -10,6 +10,8 @@ For the full list of settings and their values, see
|
|
| 10 |
https://docs.djangoproject.com/en/4.2/ref/settings/
|
| 11 |
"""
|
| 12 |
|
|
|
|
|
|
|
| 13 |
import os
|
| 14 |
from pathlib import Path
|
| 15 |
|
|
@@ -177,3 +179,11 @@ LOGIN_REDIRECT_URL = '/'
|
|
| 177 |
|
| 178 |
if os.environ.get('INSIDEDOCKER'):
|
| 179 |
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
https://docs.djangoproject.com/en/4.2/ref/settings/
|
| 11 |
"""
|
| 12 |
|
| 13 |
+
from django.contrib import admin
|
| 14 |
+
import django
|
| 15 |
import os
|
| 16 |
from pathlib import Path
|
| 17 |
|
|
|
|
| 179 |
|
| 180 |
if os.environ.get('INSIDEDOCKER'):
|
| 181 |
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
|
| 182 |
+
|
| 183 |
+
STATIC_URL = '/static/'
|
| 184 |
+
STATICFILES_DIRS = [
|
| 185 |
+
os.path.join(os.path.dirname(django.__file__),
|
| 186 |
+
'contrib', 'admin', 'static'),
|
| 187 |
+
os.path.join(os.path.dirname(django.__file__), 'contrib',
|
| 188 |
+
'auth', 'static'), # Optional if using auth
|
| 189 |
+
]
|
BridgeMentor/urls.py
CHANGED
|
@@ -14,6 +14,8 @@ Including another URLconf
|
|
| 14 |
1. Import the include() function: from django.urls import include, path
|
| 15 |
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
| 16 |
"""
|
|
|
|
|
|
|
| 17 |
from django.conf.urls.static import static
|
| 18 |
from django.conf import settings
|
| 19 |
from graphene_django.views import GraphQLView
|
|
@@ -39,10 +41,10 @@ urlpatterns = [
|
|
| 39 |
|
| 40 |
|
| 41 |
]
|
| 42 |
-
|
| 43 |
-
|
| 44 |
if settings.DEBUG:
|
| 45 |
-
urlpatterns += static(settings.STATIC_URL,
|
| 46 |
-
|
| 47 |
-
urlpatterns += static(settings.
|
| 48 |
-
|
|
|
|
|
|
|
|
|
| 14 |
1. Import the include() function: from django.urls import include, path
|
| 15 |
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
| 16 |
"""
|
| 17 |
+
import django
|
| 18 |
+
import os
|
| 19 |
from django.conf.urls.static import static
|
| 20 |
from django.conf import settings
|
| 21 |
from graphene_django.views import GraphQLView
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
]
|
|
|
|
|
|
|
| 44 |
if settings.DEBUG:
|
| 45 |
+
urlpatterns += static(settings.STATIC_URL, document_root=os.path.join(
|
| 46 |
+
os.path.dirname(django.__file__), 'contrib', 'admin', 'static'))
|
| 47 |
+
# urlpatterns += static(settings.STATIC_URL,
|
| 48 |
+
# document_root=settings.STATIC_ROOT)
|
| 49 |
+
# urlpatterns += static(settings.MEDIA_URL,
|
| 50 |
+
# document_root=settings.MEDIA_ROOT)
|
Dockerfile
CHANGED
|
@@ -38,6 +38,6 @@ RUN echo "----------------------------------------" && \
|
|
| 38 |
curl -s ifconfig.me && \
|
| 39 |
echo "\n----------------------------------------"
|
| 40 |
|
| 41 |
-
CMD ["gunicorn","BridgeMentor.wsgi:application", "--bind", "0.0.0.0:7860", "--timeout", "30", "--workers", "2"]
|
| 42 |
|
| 43 |
# CMD ["python", "manage.py", "runserver", "7860", "--verbosity", "2","--noreload"]
|
|
|
|
| 38 |
curl -s ifconfig.me && \
|
| 39 |
echo "\n----------------------------------------"
|
| 40 |
|
| 41 |
+
CMD ["DEBUG=True", "gunicorn","BridgeMentor.wsgi:application", "--bind", "0.0.0.0:7860", "--timeout", "30", "--workers", "2"]
|
| 42 |
|
| 43 |
# CMD ["python", "manage.py", "runserver", "7860", "--verbosity", "2","--noreload"]
|