Skip to content

Commit 4451588

Browse files
committed
changed files to use react build as frontend
1 parent 91d5158 commit 4451588

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

manage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def main():
88
"""Run administrative tasks."""
9-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'school.settings')
9+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "school.settings")
1010
try:
1111
from django.core.management import execute_from_command_line
1212
except ImportError as exc:
@@ -18,5 +18,5 @@ def main():
1818
execute_from_command_line(sys.argv)
1919

2020

21-
if __name__ == '__main__':
21+
if __name__ == "__main__":
2222
main()

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ dj-database-url==0.5.0
1515
Django==4.1
1616
django-cors-headers==3.13.0
1717
django-debug-toolbar==3.6.0
18-
django-heroku==0.3.1
1918
djangorestframework==3.13.1
2019
djangorestframework-simplejwt==5.2.0
2120
et-xmlfile==1.1.0

school/settings.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import imp
21
from pathlib import Path
32
from datetime import timedelta
43
from decouple import config
54
import os
6-
import django_heroku
75

86
# Build paths inside the project like this: BASE_DIR / 'subdir'.
97
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -18,7 +16,7 @@
1816
# SECURITY WARNING: don't run with debug turned on in production!
1917
DEBUG = True
2018

21-
ALLOWED_HOSTS = []
19+
ALLOWED_HOSTS = ["127.0.0.1", "localhost"]
2220

2321
import datetime
2422
from django.core.validators import MinValueValidator # Could use MaxValueValidator too
@@ -68,7 +66,7 @@
6866
{
6967
"BACKEND": "django.template.backends.django.DjangoTemplates",
7068
"DIRS": [
71-
os.path.join(BASE_DIR, "templates"),
69+
os.path.join(BASE_DIR, "templates/build"),
7270
],
7371
"APP_DIRS": True,
7472
"OPTIONS": {
@@ -95,7 +93,7 @@
9593
"USER": "postgres",
9694
"PASSWORD": config("POSTGRES_PASSWORD"),
9795
"HOST": "127.0.0.1",
98-
"PORT": "5432",
96+
"PORT": config("POSTGRES_PORT"),
9997
}
10098
}
10199

@@ -143,6 +141,8 @@
143141
MEDIA_ROOT = BASE_DIR / "static/images"
144142
STATIC_ROOT = BASE_DIR / "staticfiles"
145143

144+
STATICFILES_DIRS = [BASE_DIR / "static", BASE_DIR / "templates/build/static"]
145+
146146
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
147147

148148
REST_FRAMEWORK = {
@@ -179,8 +179,6 @@
179179

180180
CORS_ALLOW_ALL_ORIGINS = True
181181

182-
django_heroku.settings(locals())
183-
184182
AUTH_USER_MODEL = "users.CustomUser"
185183

186184
INTERNAL_IPS = [

school/urls.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
import debug_toolbar
77

88
urlpatterns = [
9-
path('admin/', admin.site.urls),
10-
path('', TemplateView.as_view(template_name='index.html')),
11-
path('api/administration/', include('api.administration.urls')),
12-
#path('api/attendance/', include('api.attendance.urls')),
13-
path('api/assignments/', include('api.assignments.urls')),
14-
path('api/blog/', include('api.blog.urls')),
15-
path('api/finance/', include('api.finance.urls')),
16-
#path('api/journals/', include('api.journals.urls')),
17-
path('api/notes/', include('api.notes.urls')),
18-
path('api/users/', include('api.users.urls')),
19-
path('api/sis/', include('api.sis.urls')),
20-
path('__debug__/', include(debug_toolbar.urls)),
9+
path("admin/", admin.site.urls),
10+
path("", TemplateView.as_view(template_name="index.html")),
11+
path("api/administration/", include("api.administration.urls")),
12+
# path('api/attendance/', include('api.attendance.urls')),
13+
path("api/assignments/", include("api.assignments.urls")),
14+
path("api/blog/", include("api.blog.urls")),
15+
path("api/finance/", include("api.finance.urls")),
16+
# path('api/journals/', include('api.journals.urls')),
17+
path("api/notes/", include("api.notes.urls")),
18+
path("api/users/", include("api.users.urls")),
19+
path("api/sis/", include("api.sis.urls")),
20+
path("__debug__/", include(debug_toolbar.urls)),
2121
]
2222

2323
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

0 commit comments

Comments
 (0)