Skip to content

Commit 01f897e

Browse files
committed
cp app
1 parent 5b071cd commit 01f897e

17 files changed

+41
-1
lines changed

Diff for: .vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"CodeGPT.apiKey": "CodeGPT Plus Beta"
3+
}

Diff for: mysite/config/settings/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
'django.contrib.sites',
4444
'allauth',
4545
'allauth.socialaccount.providers.google',
46+
'cp'
4647
]
4748

4849
MIDDLEWARE = [
@@ -126,6 +127,7 @@
126127
# https://docs.djangoproject.com/en/5.0/howto/static-files/
127128

128129
STATIC_URL = '/static/'
130+
STATIC_ROOT = '/static/'
129131
STATICFILES_DIRS = [
130132
BASE_DIR / 'static',
131133
]

Diff for: mysite/config/settings/prod.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22

33
ALLOWED_HOSTS = ['43.201.203.109', 'choihaha.com']
44

5-
DEBUG = False
5+
DEBUG = False
6+
7+
STATIC_ROOT = BASE_DIR / 'static/'
8+
STATICFILES_DIRS = []

Diff for: mysite/config/urls.py

+2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
from pybo import views
2020
from django.conf import settings
2121
from django.conf.urls.static import static
22+
from cp import views as cpviews
2223

2324
urlpatterns = [
2425
path('admin/', admin.site.urls),
2526
path('pybo/', include('pybo.urls')),
2627
path('common/', include('common.urls')),
2728
path('', views.index, name='index'),
29+
path('cp/', include('cp.urls')),
2830
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Diff for: mysite/cp/logic.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
place = 1
4+
5+
def get_place():
6+
return place
7+
8+
def set_place(p):
9+
global place
10+
place = p

Diff for: mysite/cp/urls.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.urls import path
2+
from . import views
3+
4+
urlpatterns = [
5+
path('car/', views.req, name='cp'),
6+
]

Diff for: mysite/cp/views.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from django.http import JsonResponse
2+
from django.views.decorators.csrf import csrf_exempt
3+
from . import logic
4+
5+
@csrf_exempt
6+
def req(request):
7+
if request.method == 'GET':
8+
return JsonResponse({"position": f"{logic.get_place()}"})
9+
if request.method == 'POST':
10+
try:
11+
logic.set_place(request.POST.get('position'))
12+
return JsonResponse({"position": f"{logic.get_place()}"})
13+
except :
14+
return JsonResponse({"error":"server fail"}, status=400)

Diff for: mysite/static/main.js

100644100755
File mode changed.

Diff for: mysite/static/navbar.css

100644100755
File mode changed.

Diff for: mysite/static/profile.css

100644100755
File mode changed.

Diff for: mysite/static/profile.js

100644100755
File mode changed.

Diff for: mysite/static/question_detail.css

100644100755
File mode changed.

Diff for: mysite/static/question_detail.js

100644100755
File mode changed.

Diff for: mysite/static/question_form.css

100644100755
File mode changed.

Diff for: mysite/static/question_list.css

100644100755
File mode changed.

Diff for: mysite/static/question_list.js

100644100755
File mode changed.

Diff for: mysite/static/styles.css

100644100755
File mode changed.

0 commit comments

Comments
 (0)