質問するログイン新規登録

質問編集履歴

7

質問の解答

2020/06/27 06:14

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -9,7 +9,7 @@
9
9
  ### 発生している問題・エラーメッセージ
10
10
 
11
11
  ```
12
- [25/Jun/2020 21:49:14] "POST /hoge/ HTTP/1.1" 400 73
12
+ Ensure this field has no more than 20000 characters.
13
13
  ```
14
14
 
15
15
  ### 該当のソースコード

6

質問の解答

2020/06/27 06:14

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -32,6 +32,137 @@
32
32
  print(res.status_code)
33
33
  ```
34
34
 
35
+ ```
36
+ """
37
+ Django settings for tutorial project.
38
+
39
+ Generated by 'django-admin startproject' using Django 2.2.13.
40
+
41
+ For more information on this file, see
42
+ https://docs.djangoproject.com/en/2.2/topics/settings/
43
+
44
+ For the full list of settings and their values, see
45
+ https://docs.djangoproject.com/en/2.2/ref/settings/
46
+ """
47
+
48
+ import os
49
+
50
+ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
51
+ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
52
+
53
+
54
+ # Quick-start development settings - unsuitable for production
55
+ # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
56
+
57
+ # SECURITY WARNING: keep the secret key used in production secret!
58
+ 省略
59
+ # SECURITY WARNING: don't run with debug turned on in production!
60
+ DEBUG = True
61
+
62
+ ALLOWED_HOSTS = []
63
+
64
+
65
+ # Application definition
66
+
67
+ INSTALLED_APPS = [
68
+ 'django.contrib.admin',
69
+ 'django.contrib.auth',
70
+ 'django.contrib.contenttypes',
71
+ 'django.contrib.sessions',
72
+ 'django.contrib.messages',
73
+ 'django.contrib.staticfiles',
74
+ 'rest_framework',
75
+ 'tutorial.quickstart',
76
+ ]
77
+
78
+ MIDDLEWARE = [
79
+ 'django.middleware.security.SecurityMiddleware',
80
+ 'django.contrib.sessions.middleware.SessionMiddleware',
81
+ 'django.middleware.common.CommonMiddleware',
82
+ 'django.middleware.csrf.CsrfViewMiddleware',
83
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
84
+ 'django.contrib.messages.middleware.MessageMiddleware',
85
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
86
+ ]
87
+
88
+ ROOT_URLCONF = 'tutorial.urls'
89
+
90
+ TEMPLATES = [
91
+ {
92
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
93
+ 'DIRS': [],
94
+ 'APP_DIRS': True,
95
+ 'OPTIONS': {
96
+ 'context_processors': [
97
+ 'django.template.context_processors.debug',
98
+ 'django.template.context_processors.request',
99
+ 'django.contrib.auth.context_processors.auth',
100
+ 'django.contrib.messages.context_processors.messages',
101
+ ],
102
+ },
103
+ },
104
+ ]
105
+
106
+ WSGI_APPLICATION = 'tutorial.wsgi.application'
107
+
108
+
109
+ # Database
110
+ # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
111
+
112
+ DATABASES = {
113
+ 'default': {
114
+ 'ENGINE': 'djongo',
115
+ 'NAME': 'pointcloud',
116
+ }
117
+ }
118
+
119
+
120
+ # Password validation
121
+ # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
122
+
123
+ AUTH_PASSWORD_VALIDATORS = [
124
+ {
125
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
126
+ },
127
+ {
128
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
129
+ },
130
+ {
131
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
132
+ },
133
+ {
134
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
135
+ },
136
+ ]
137
+
138
+
139
+ # Internationalization
140
+ # https://docs.djangoproject.com/en/2.2/topics/i18n/
141
+
142
+ LANGUAGE_CODE = 'en-us'
143
+
144
+ TIME_ZONE = 'UTC'
145
+
146
+ USE_I18N = True
147
+
148
+ USE_L10N = True
149
+
150
+ USE_TZ = True
151
+
152
+
153
+ # Static files (CSS, JavaScript, Images)
154
+ # https://docs.djangoproject.com/en/2.2/howto/static-files/
155
+
156
+ STATIC_URL = '/static/'
157
+
158
+ REST_FRAMEWORK = {
159
+ 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
160
+ 'PAGE_SIZE': 10
161
+ }
162
+
163
+
164
+ ```
165
+
35
166
  ###試したこと
36
167
  settings.pyに
37
168
  ```

5

変更

2020/06/27 05:49

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  DjangoのAPIサーバーを立てて、pythonクライアントからjsonデータをPOSTしようとしています。
4
4
  その際に、サイズの小さなデータは成功するのですが、
5
- 以下のようにx,y,z(110kbyte程度ずつ)のデータをvalueとして設定すると400エラーが返ってきます。
5
+ 以下のようにx,y,z(110kbyte程度ずつの文字列)のデータをvalueとして設定すると400エラーが返ってきます。
6
6
  何が原因なのでしょうか。
7
7
  わかる方がいましたらコメントお願いします。
8
8
 

4

記載ミス

2020/06/27 04:24

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  DjangoのAPIサーバーを立てて、pythonクライアントからjsonデータをPOSTしようとしています。
4
4
  その際に、サイズの小さなデータは成功するのですが、
5
- 以下のようにx,y,z(len>100000)のデータをvalueとして設定すると400エラーが返ってきます。
5
+ 以下のようにx,y,z(110kbyte程度ずつ)のデータをvalueとして設定すると400エラーが返ってきます。
6
6
  何が原因なのでしょうか。
7
7
  わかる方がいましたらコメントお願いします。
8
8
 

3

変更

2020/06/27 04:23

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -13,6 +13,11 @@
13
13
  ```
14
14
 
15
15
  ### 該当のソースコード
16
+ ```
17
+ //送信するデータ
18
+ print(x[:100])
19
+ //-120.000000,-170.153854,-257.250000,-316.144226,-344.192322,-462.980774,-471.038483,-475.201935,-565
20
+ ```
16
21
 
17
22
  ```sample
18
23
  # リクエストパラメータ

2

記載ミス

2020/06/27 04:22

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -25,4 +25,11 @@
25
25
 
26
26
  with requests.post(url, headers=headers, json=data) as res:
27
27
  print(res.status_code)
28
- ```
28
+ ```
29
+
30
+ ###試したこと
31
+ settings.pyに
32
+ ```
33
+ DATA_UPLOAD_MAX_MEMORY_SIZE = 5242880
34
+ ```
35
+ を追加しても変わらなかったので、容量の問題ではないのかなと思います。

1

変更

2020/06/27 04:14

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -17,9 +17,9 @@
17
17
  ```sample
18
18
  # リクエストパラメータ
19
19
  data={
20
- 'x': x,
20
+ 'x': x, (110kbyte前後)
21
- 'y': y,
21
+ 'y': y, (110kbyte前後)
22
- 'z': z,
22
+ 'z': z, (110kbyte前後)
23
23
  }
24
24
 
25
25