Skip to content
Snippets Groups Projects
Commit bc6e971a authored by EC2 Default User's avatar EC2 Default User Committed by chris
Browse files

server settings

parent d0add89d
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@
__pycache__
db.sqlite3
static
staticfiles
media
core/migrations/*.py
......
......@@ -60,6 +60,7 @@ REST_KNOX = {
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
......@@ -136,14 +137,14 @@ USE_TZ = True
# https://docs.djangoproject.com/en/4.1/howto/static-files/
STATIC_URL = 'static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
STATICFILES_DIRS = (
("js", os.path.join(STATIC_ROOT, 'js')),
("css", os.path.join(STATIC_ROOT, 'css')),
("images", os.path.join(STATIC_ROOT, 'images')),
("fonts", os.path.join(STATIC_ROOT, 'fonts')),
)
if DEBUG:
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)
else:
# STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_ROOT = BASE_DIR / "staticfiles"
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
......@@ -160,4 +161,4 @@ EMAIL_HOST_PASSWORD = 'psqytbyafqujeiji'
# Media Settings
MEDIA_URL = 'media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
......@@ -2,6 +2,7 @@ from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from django.views.static import serve
from rest_framework import routers
from rest_framework.documentation import include_docs_urls
......@@ -9,11 +10,11 @@ router = routers.DefaultRouter()
urlpatterns = router.urls
# urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += [
path('', include('core.urls')),
path('admin/', admin.site.urls),
path('docs/', include_docs_urls(title='ECE651 Backend API Document', description='This API document includes all ednpoints that has been implemented.')),
]
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment