react project build within django
This commit is contained in:
parent
ba31b0e8d7
commit
f86b2772c5
|
@ -1,7 +1,9 @@
|
|||
from django.views.generic import TemplateView
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', TemplateView.as_view(template_name='index.html')),
|
||||
path('users/login', views.MyTokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||
path('routes', views.getRoutes, name="routes"),
|
||||
path('users/<str:pk>', views.getUserDetails, name="user-details"),
|
||||
|
@ -11,3 +13,5 @@ urlpatterns = [
|
|||
path('update-responsible', views.setNeigbourhoodResponsible, name="update-responsible"),
|
||||
# path('users/', views.getUsers, name="users"),
|
||||
]
|
||||
|
||||
#
|
||||
|
|
|
@ -12,11 +12,11 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
|
|||
import pymysql
|
||||
from pathlib import Path
|
||||
from datetime import timedelta
|
||||
import os
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
||||
|
||||
|
@ -92,7 +92,9 @@ ROOT_URLCONF = 'backend.urls'
|
|||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'DIRS': [
|
||||
os.path.join(BASE_DIR, 'frontend/build')
|
||||
],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
|
@ -165,3 +167,9 @@ STATIC_URL = '/static/'
|
|||
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
STATICFILES_DIRS = [
|
||||
BASE_DIR / 'frontend/build/static'
|
||||
]
|
||||
|
||||
# CORS_ALLOW_ALL_ORIGINS = True
|
||||
|
|
Loading…
Reference in New Issue