Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue_django_test
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周田
vue_django_test
Commits
f08c14e0
Commit
f08c14e0
authored
Aug 29, 2023
by
周田
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:前后端分离(方便调试)
parent
338a39bf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletions
+25
-1
vite.config.ts
frontend/vite.config.ts
+9
-1
settings.py
vue_django/settings.py
+16
-0
No files found.
frontend/vite.config.ts
View file @
f08c14e0
...
...
@@ -25,8 +25,16 @@ export default defineConfig({
vue
(),
UnoCSS
()
],
base
:
'./'
,
//
base: './',
server
:
{
host
:
'0.0.0.0'
,
port
:
5173
,
proxy
:
{
'/api'
:
{
target
:
'http://localhost:8000/'
,
changeOrigin
:
true
}
}
},
})
vue_django/settings.py
View file @
f08c14e0
...
...
@@ -44,6 +44,7 @@ INSTALLED_APPS = [
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'corsheaders'
,
'rest_framework'
,
'drf_yasg'
,
]
...
...
@@ -163,3 +164,18 @@ CHANNEL_LAYERS = {
# },
# },
}
CORS_ALLOW_CREDENTIALS
=
True
CORS_ORIGIN_ALLOW_ALL
=
True
CORS_ALLOW_HEADERS
=
[
'x-requested-with'
,
'content-type'
,
'accept'
,
'origin'
,
'authorization'
,
'x-csrftoken'
,
'token'
]
CORS_ALLOWED_ORIGINS
=
[
"http://127.0.0.1:5173"
,
# 您的前端应用地址
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment