작성
·
153
0
강의와 같이 perform_create 함수를 구성하였을때 웹으로 post 요청을 보냈을때에는 데이터가 생성이 되었는데, httpie를 통한 post 요청시에는 아래와 같은 html 응답이 넘어오면서 에러가 났습니다. 혹시 이 문제의 원인이 무엇인지 알 수 있을까요?? 밑에 설명 문구에 DEBUG=True이기 때문에 해당 에러가 발생했다고 하여 False로 바꾸어 보았지만 해결이 되지 않았습니다. 그리고 post를 제외한 다른 요청들은 모두 정삭적으로 응답이 옵니다.
<tr> <td>self</td> <td class="code"><pre><django.db.models.fields.related_descriptors.ForwardManyToOneDescri ptor object at 0x0000012F717A5670></pre></td> </tr> <tr> <td>value</td> <td class="code"><pre><django.contrib.auth.models.AnonymousUser object at 0x0000012F7293A 190></pre></td> </tr> </tbody> </table> </details> </li> </ul> </div> <form action="https://dpaste.com/" name="pasteform" id="pasteform" method="post"> <div id="pastebinTraceback" class="pastebin"> <input type="hidden" name="language" value="PythonConsole"> <input type="hidden" name="title" value="ValueError at /ukstagram/posts/"> <input type="hidden" name="source" value="Django Dpaste Agent"> <input type="hidden" name="poster" value="Django"> <textarea name="content" id="traceback_area" cols="140" rows="25"> Environment: Request Method: POST Request URL: http://localhost:8000/ukstagram/posts/ Django Version: 4.0.4 Python Version: 3.8.12 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'ukstagram'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback (most recent call last): File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\core\handlers\exception.py", line 55, in inner response = get_response(request) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\core\handlers\base.py", line 197, in _get_respon se response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_v iew return view_func(*args, **kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\viewsets.py", line 125, in view return self.dispatch(request, *args, **kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py", line 509, in dispatch response = self.handle_exception(exc) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_e xception raise exc File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\mixins.py", line 19, in create self.perform_create(serializer) File "C:\Users\cswoo\OneDrive\Documents\DRF\ukstagram\views.py", line 46, in perform_create serializer.save(author=self.request.user) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\serializers.py", line 212, in save self.instance = self.create(validated_data) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\serializers.py", line 962, in create instance = ModelClass._default_manager.create(**validated_data) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\manager.py", line 85, in manager_metho d return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\query.py", line 512, in create obj = self.model(**kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\base.py", line 541, in __init__ _setattr(self, field.name, rel_obj) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\fields\related_descriptors.py", line 2 35, in __set__ raise ValueError( Exception Type: ValueError at /ukstagram/posts/ Exception Value: Cannot assign "<django.contrib.auth.models.AnonymousUser object at 0x0000012F7293A190&g t;": "Post.author" must be a "User" instance. </textarea> <br><br> <input type="submit" value="Share this traceback on a public website"> </div> </form> </div> <div id="requestinfo"> <h2>Request information</h2> <h3 id="user-info">USER</h3> <p>AnonymousUser</p> <h3 id="get-info">GET</h3> <p>No GET data</p> <h3 id="post-info">POST</h3> <p>No POST data</p> <h3 id="files-info">FILES</h3> <p>No FILES data</p> <h3 id="cookie-info">COOKIES</h3> <p>No cookie data</p> <h3 id="meta-info">META</h3> <table class="req"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>ALLUSERSPROFILE</td> <td class="code"><pre>'C:\\ProgramData'</pre></td> </tr> <tr> <td>APPDATA</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Roaming'</pre></td> </tr> <tr> <td>CLSID</td> <td class="code"><pre>'{290BFAA9-A9FC-AD78-7B4F-4803F0742CCA}'</pre></td> </tr> <tr> <td>COMMONPROGRAMFILES</td> <td class="code"><pre>'C:\\Program Files\\Common Files'</pre></td> </tr> <tr> <td>COMMONPROGRAMFILES(X86)</td> <td class="code"><pre>'C:\\Program Files (x86)\\Common Files'</pre></td> </tr> <tr> <td>COMMONPROGRAMW6432</td> <td class="code"><pre>'C:\\Program Files\\Common Files'</pre></td> </tr> <tr> <td>COMPUTERNAME</td> <td class="code"><pre>'DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>COMSPEC</td> <td class="code"><pre>'C:\\WINDOWS\\system32\\cmd.exe'</pre></td> </tr> <tr> <td>CONDA_DEFAULT_ENV</td> <td class="code"><pre>'drf'</pre></td> </tr> <tr> <td>CONDA_PREFIX</td> <td class="code"><pre>'C:\\Users\\cswoo\\.conda\\envs\\drf'</pre></td> </tr> <tr> <td>CONDA_PROMPT_MODIFIER</td> <td class="code"><pre>'(drf) '</pre></td> </tr> <tr> <td>CONDA_SHLVL</td> <td class="code"><pre>'1'</pre></td> </tr> <tr> <td>CONTENT_LENGTH</td> <td class="code"><pre>'45'</pre></td> </tr> <tr> <td>CONTENT_TYPE</td> <td class="code"><pre>'application/json'</pre></td> </tr> <tr> <td>DJANGO_SETTINGS_MODULE</td> <td class="code"><pre>'DRF.settings'</pre></td> </tr> <tr> <td>DRIVERDATA</td> <td class="code"><pre>'C:\\Windows\\System32\\Drivers\\DriverData'</pre></td> </tr> <tr> <td>FPS_BROWSER_APP_PROFILE_STRING</td> <td class="code"><pre>'Internet Explorer'</pre></td> </tr> <tr> <td>FPS_BROWSER_USER_PROFILE_STRING</td> <td class="code"><pre>'Default'</pre></td> </tr> <tr> <td>GATEWAY_INTERFACE</td> <td class="code"><pre>'CGI/1.1'</pre></td> </tr> <tr> <td>GOOGLE_API_KEY</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>GOOGLE_DEFAULT_CLIENT_ID</td> <td class="code"><pre>'no'</pre></td> </tr> <tr> <td>GOOGLE_DEFAULT_CLIENT_SECRET</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>HOMEDRIVE</td> <td class="code"><pre>'C:'</pre></td> </tr> <tr> <td>HOMEPATH</td> <td class="code"><pre>'\\Users\\cswoo'</pre></td> </tr> <tr> <td>HTTP_ACCEPT</td> <td class="code"><pre>'application/json, */*;q=0.5'</pre></td> </tr> <tr> <td>HTTP_ACCEPT_ENCODING</td> <td class="code"><pre>'gzip, deflate'</pre></td> </tr> <tr> <td>HTTP_CONNECTION</td> <td class="code"><pre>'keep-alive'</pre></td> </tr> <tr> <td>HTTP_HOST</td> <td class="code"><pre>'localhost:8000'</pre></td> </tr> <tr> <td>HTTP_USER_AGENT</td> <td class="code"><pre>'HTTPie/3.1.0'</pre></td> </tr> <tr> <td>IDEA_INITIAL_DIRECTORY</td> <td class="code"><pre>'C:\\Users\\cswoo\\OneDrive\\Documents'</pre></td> </tr> <tr> <td>LOCALAPPDATA</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Local'</pre></td> </tr> <tr> <td>LOGONSERVER</td> <td class="code"><pre>'\\\\DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>NUMBER_OF_PROCESSORS</td> <td class="code"><pre>'6'</pre></td> </tr> <tr> <td>ONEDRIVE</td> <td class="code"><pre>'C:\\Users\\cswoo\\OneDrive'</pre></td> </tr> <tr> <td>ONEDRIVECONSUMER</td> <td class="code"><pre>'C:\\Users\\cswoo\\OneDrive'</pre></td> </tr> <tr> <td>OS</td> <td class="code"><pre>'Windows_NT'</pre></td> </tr> <tr> <td>PATH</td> <td class="code"><pre>('C:\\Users\\cswoo\\.conda\\envs\\drf;C:\\Users\\cswoo\\.conda\\envs\\drf\\ Library\\mingw-w64\\bin;C:\\Users\\cswoo\\.conda\\envs\\drf\\Library\\usr\\bin;C:\\Users\\cswoo\\.conda\\envs\\d rf\\Library\\bin;C:\\Users\\cswoo\\.conda\\envs\\drf\\Scripts;C:\\Users\\cswoo\\.conda\\envs\\drf\\bin;C:\\Progr amData\\Anaconda3\\condabin;C:\\ProgramData\\Anaconda3;C:\\ProgramData\\Anaconda3\\Library\\mingw-w64\\bin;C:\\P rogramData\\Anaconda3\\Library\\usr\\bin;C:\\ProgramData\\Anaconda3\\Library\\bin;C:\\ProgramData\\Anaconda3\\Sc ripts;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1 .0;C:\\WINDOWS\\System32\\OpenSSH;C:\\Program ' 'Files\\Git\\cmd;C:\\Users\\cswoo\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\cswoo\\AppData\\Local \\Microsoft\\WindowsApps;C:\\Program ' 'Files\\JetBrains\\PyCharm Community Edition ' '2021.2.2\\bin;.;C:\\Users\\cswoo\\AppData\\Local\\afreeca;C:\\Users\\cswoo\\AppData\\Local\\Programs\\Mic rosoft ' 'VS Code\\bin;C:\\Program Files\\JetBrains\\PyCharm 2021.3.3\\bin;.')</pre></td> </tr> <tr> <td>PATHEXT</td> <td class="code"><pre>'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'</pre></td> </tr> <tr> <td>PATH_INFO</td> <td class="code"><pre>'/ukstagram/posts/'</pre></td> </tr> <tr> <td>PROCESSOR_ARCHITECTURE</td> <td class="code"><pre>'AMD64'</pre></td> </tr> <tr> <td>PROCESSOR_IDENTIFIER</td> <td class="code"><pre>'Intel64 Family 6 Model 158 Stepping 10, GenuineIntel'</pre></td> </tr> <tr> <td>PROCESSOR_LEVEL</td> <td class="code"><pre>'6'</pre></td> </tr> <tr> <td>PROCESSOR_REVISION</td> <td class="code"><pre>'9e0a'</pre></td> </tr> <tr> <td>PROGRAMDATA</td> <td class="code"><pre>'C:\\ProgramData'</pre></td> </tr> <tr> <td>PROGRAMFILES</td> <td class="code"><pre>'C:\\Program Files'</pre></td> </tr> <tr> <td>PROGRAMFILES(X86)</td> <td class="code"><pre>'C:\\Program Files (x86)'</pre></td> </tr> <tr> <td>PROGRAMW6432</td> <td class="code"><pre>'C:\\Program Files'</pre></td> </tr> <tr> <td>PROMPT</td> <td class="code"><pre>'(drf) $P$G'</pre></td> </tr> <tr> <td>PSMODULEPATH</td> <td class="code"><pre>('C:\\Program ' 'Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules')</pre></t d> </tr> <tr> <td>PUBLIC</td> <td class="code"><pre>'C:\\Users\\Public'</pre></td> </tr> <tr> <td>PYCHARM</td> <td class="code"><pre>'C:\\Program Files\\JetBrains\\PyCharm 2021.3.3\\bin;'</pre></td> </tr> <tr> <td>PYCHARM COMMUNITY EDITION</td> <td class="code"><pre>'C:\\Program Files\\JetBrains\\PyCharm Community Edition 2021.2.2\\bin; 7;</pre></td> </tr> <tr> <td>PYTHONIOENCODING</td> <td class="code"><pre>'utf-8'</pre></td> </tr> <tr> <td>QUERY_STRING</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>REMOTE_ADDR</td> <td class="code"><pre>'127.0.0.1'</pre></td> </tr> <tr> <td>REMOTE_HOST</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>REQUEST_METHOD</td> <td class="code"><pre>'POST'</pre></td> </tr> <tr> <td>RUN_MAIN</td> <td class="code"><pre>'true'</pre></td> </tr> <tr> <td>SCRIPT_NAME</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>SERVER_NAME</td> <td class="code"><pre>'DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>SERVER_PORT</td> <td class="code"><pre>'8000'</pre></td> </tr> <tr> <td>SERVER_PROTOCOL</td> <td class="code"><pre>'HTTP/1.1'</pre></td> </tr> <tr> <td>SERVER_SOFTWARE</td> <td class="code"><pre>'WSGIServer/0.2'</pre></td> </tr> <tr> <td>SESSIONNAME</td> <td class="code"><pre>'Console'</pre></td> </tr> <tr> <td>SYSTEMDRIVE</td> <td class="code"><pre>'C:'</pre></td> </tr> <tr> <td>SYSTEMROOT</td> <td class="code"><pre>'C:\\WINDOWS'</pre></td> </tr> <tr> <td>TEMP</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Local\\Temp'</pre></td> </tr> <tr> <td>TERMINAL_EMULATOR</td> <td class="code"><pre>'JetBrains-JediTerm'</pre></td> </tr> <tr> <td>TERM_SESSION_ID</td> <td class="code"><pre>'8e1c69ed-565b-4df9-abcb-4027930ba073'</pre></td> </tr> <tr> <td>TMP</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Local\\Temp'</pre></td> </tr> <tr> <td>USERDOMAIN</td> <td class="code"><pre>'DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>USERDOMAIN_ROAMINGPROFILE</td> <td class="code"><pre>'DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>USERNAME</td> <td class="code"><pre>'cswoo'</pre></td> </tr> <tr> <td>USERPROFILE</td> <td class="code"><pre>'C:\\Users\\cswoo'</pre></td> </tr> <tr> <td>WINDIR</td> <td class="code"><pre>'C:\\WINDOWS'</pre></td> </tr> <tr> <td>__INTELLIJ_COMMAND_HISTFILE__</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Local\\JetBrains\\PyCharm2021.3\\terminal\\hist ory\\DRF-history'</pre></td> </tr> <tr> <td>wsgi.errors</td> <td class="code"><pre><colorama.ansitowin32.StreamWrapper object at 0x0000012F70805610></pre></t d> </tr> <tr> <td>wsgi.file_wrapper</td> <td class="code"><pre><class 'wsgiref.util.FileWrapper'></pre></td> </tr> <tr> <td>wsgi.input</td> <td class="code"><pre><django.core.handlers.wsgi.LimitedStream object at 0x0000012F72D67E50></pr e></td> </tr> <tr> <td>wsgi.multiprocess</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>wsgi.multithread</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>wsgi.run_once</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>wsgi.url_scheme</td> <td class="code"><pre>'http'</pre></td> </tr> <tr> <td>wsgi.version</td> <td class="code"><pre>(1, 0)</pre></td> </tr> </tbody> </table> <h3 id="settings-info">Settings</h3> <h4>Using settings module <code>DRF.settings</code></h4> <table class="req"> <thead> <tr> <th>Setting</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>ABSOLUTE_URL_OVERRIDES</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>ADMINS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>ALLOWED_HOSTS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>APPEND_SLASH</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>AUTHENTICATION_BACKENDS</td> <td class="code"><pre>['django.contrib.auth.backends.ModelBackend']</pre></td> </tr> <tr> <td>AUTH_PASSWORD_VALIDATORS</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>AUTH_USER_MODEL</td> <td class="code"><pre>'auth.User'</pre></td> </tr> <tr> <td>BASE_DIR</td> <td class="code"><pre>WindowsPath('C:/Users/cswoo/OneDrive/Documents/DRF')</pre></td> </tr> <tr> <td>CACHES</td> <td class="code"><pre>{'default': {'BACKEND': 'django.core.cache.backends.loc mem.LocMemCache'}}</pre></td> </tr> <tr> <td>CACHE_MIDDLEWARE_ALIAS</td> <td class="code"><pre>'default'</pre></td> </tr> <tr> <td>CACHE_MIDDLEWARE_KEY_PREFIX</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>CACHE_MIDDLEWARE_SECONDS</td> <td class="code"><pre>600</pre></td> </tr> <tr> <td>CSRF_COOKIE_AGE</td> <td class="code"><pre>31449600</pre></td> </tr> <tr> <td>CSRF_COOKIE_DOMAIN</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>CSRF_COOKIE_HTTPONLY</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>CSRF_COOKIE_NAME</td> <td class="code"><pre>'csrftoken'</pre></td> </tr> <tr> <td>CSRF_COOKIE_PATH</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>CSRF_COOKIE_SAMESITE</td> <td class="code"><pre>'Lax'</pre></td> </tr> <tr> <td>CSRF_COOKIE_SECURE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>CSRF_FAILURE_VIEW</td> <td class="code"><pre>'django.views.csrf.csrf_failure'</pre></td> </tr> <tr> <td>CSRF_HEADER_NAME</td> <td class="code"><pre>'HTTP_X_CSRFTOKEN'</pre></td> </tr> <tr> <td>CSRF_TRUSTED_ORIGINS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>CSRF_USE_SESSIONS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>DATABASES</td> <td class="code"><pre>{'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': WindowsPath('C:/Users/cswoo/OneDrive/Documents/DRF/db.sqlite3'), 'OPTIONS': {}, 'PASSWORD': '********************', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': ''}}</pre></td> </tr> <tr> <td>DATABASE_ROUTERS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>DATA_UPLOAD_MAX_MEMORY_SIZE</td> <td class="code"><pre>2621440</pre></td> </tr> <tr> <td>DATA_UPLOAD_MAX_NUMBER_FIELDS</td> <td class="code"><pre>1000</pre></td> </tr> <tr> <td>DATETIME_FORMAT</td> <td class="code"><pre>'N j, Y, P'</pre></td> </tr> <tr> <td>DATETIME_INPUT_FORMATS</td> <td class="code"><pre>['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M']</pre></td> </tr> <tr> <td>DATE_FORMAT</td> <td class="code"><pre>'N j, Y'</pre></td> </tr> <tr> <td>DATE_INPUT_FORMATS</td> <td class="code"><pre>['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']</pre></td> </tr> <tr> <td>DEBUG</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>DEBUG_PROPAGATE_EXCEPTIONS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>DECIMAL_SEPARATOR</td> <td class="code"><pre>'.'</pre></td> </tr> <tr> <td>DEFAULT_AUTO_FIELD</td> <td class="code"><pre>'django.db.models.BigAutoField'</pre></td> </tr> <tr> <td>DEFAULT_CHARSET</td> <td class="code"><pre>'utf-8'</pre></td> </tr> <tr> <td>DEFAULT_EXCEPTION_REPORTER</td> <td class="code"><pre>'django.views.debug.ExceptionReporter'</pre></td> </tr> <tr> <td>DEFAULT_EXCEPTION_REPORTER_FILTER</td> <td class="code"><pre>'django.views.debug.SafeExceptionReporterFilter'</pre></td> </tr> <tr> <td>DEFAULT_FILE_STORAGE</td> <td class="code"><pre>'django.core.files.storage.FileSystemStorage'</pre></td> </tr> <tr> <td>DEFAULT_FROM_EMAIL</td> <td class="code"><pre>'webmaster@localhost'</pre></td> </tr> <tr> <td>DEFAULT_INDEX_TABLESPACE</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>DEFAULT_TABLESPACE</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>DISALLOWED_USER_AGENTS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>EMAIL_BACKEND</td> <td class="code"><pre>'django.core.mail.backends.smtp.EmailBackend'</pre></td> </tr> <tr> <td>EMAIL_HOST</td> <td class="code"><pre>'localhost'</pre></td> </tr> <tr> <td>EMAIL_HOST_PASSWORD</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>EMAIL_HOST_USER</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>EMAIL_PORT</td> <td class="code"><pre>25</pre></td> </tr> <tr> <td>EMAIL_SSL_CERTFILE</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>EMAIL_SSL_KEYFILE</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>EMAIL_SUBJECT_PREFIX</td> <td class="code"><pre>'[Django] '</pre></td> </tr> <tr> <td>EMAIL_TIMEOUT</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>EMAIL_USE_LOCALTIME</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>EMAIL_USE_SSL</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>EMAIL_USE_TLS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>FILE_UPLOAD_DIRECTORY_PERMISSIONS</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FILE_UPLOAD_HANDLERS</td> <td class="code"><pre>['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']</pre></td> </tr> <tr> <td>FILE_UPLOAD_MAX_MEMORY_SIZE</td> <td class="code"><pre>2621440</pre></td> </tr> <tr> <td>FILE_UPLOAD_PERMISSIONS</td> <td class="code"><pre>420</pre></td> </tr> <tr> <td>FILE_UPLOAD_TEMP_DIR</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FIRST_DAY_OF_WEEK</td> <td class="code"><pre>0</pre></td> </tr> <tr> <td>FIXTURE_DIRS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>FORCE_SCRIPT_NAME</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FORMAT_MODULE_PATH</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FORM_RENDERER</td> <td class="code"><pre>'django.forms.renderers.DjangoTemplates'</pre></td> </tr> <tr> <td>IGNORABLE_404_URLS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>INSTALLED_APPS</td> <td class="code"><pre>['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'ukstagram']</pre></td> </tr> <tr> <td>INTERNAL_IPS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>LANGUAGES</td> <td class="code"><pre>[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ar-dz', 'Algerian Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('hy', 'Armenian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('ig', 'Igbo'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('ky', 'Kyrgyz'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('ms', 'Malay'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('tg', 'Tajik'), ('th', 'Thai'), ('tk', 'Turkmen'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('uz', 'Uzbek'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')]</pre></td> </tr> <tr> <td>LANGUAGES_BIDI</td> <td class="code"><pre>['he', 'ar', 'ar-dz', 'fa', 'ur 7;]</pre></td> </tr> <tr> <td>LANGUAGE_CODE</td> <td class="code"><pre>'en-us'</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_AGE</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_DOMAIN</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_HTTPONLY</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_NAME</td> <td class="code"><pre>'django_language'</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_PATH</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_SAMESITE</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_SECURE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>LOCALE_PATHS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>LOGGING</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>LOGGING_CONFIG</td> <td class="code"><pre>'logging.config.dictConfig'</pre></td> </tr> <tr> <td>LOGIN_REDIRECT_URL</td> <td class="code"><pre>'/accounts/profile/'</pre></td> </tr> <tr> <td>LOGIN_URL</td> <td class="code"><pre>'/accounts/login/'</pre></td> </tr> <tr> <td>LOGOUT_REDIRECT_URL</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>MANAGERS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>MEDIA_ROOT</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>MEDIA_URL</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>MESSAGE_STORAGE</td> <td class="code"><pre>'django.contrib.messages.storage.fallback.FallbackStorage'</pre></td> </tr> <tr> <td>MIDDLEWARE</td> <td class="code"><pre>['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']</pre></td> </tr> <tr> <td>MIGRATION_MODULES</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>MONTH_DAY_FORMAT</td> <td class="code"><pre>'F j'</pre></td> </tr> <tr> <td>NUMBER_GROUPING</td> <td class="code"><pre>0</pre></td> </tr> <tr> <td>PASSWORD_HASHERS</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>PASSWORD_RESET_TIMEOUT</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>PREPEND_WWW</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>ROOT_URLCONF</td> <td class="code"><pre>'DRF.urls'</pre></td> </tr> <tr> <td>SECRET_KEY</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>SECURE_CONTENT_TYPE_NOSNIFF</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>SECURE_CROSS_ORIGIN_OPENER_POLICY</td> <td class="code"><pre>'same-origin'</pre></td> </tr> <tr> <td>SECURE_HSTS_INCLUDE_SUBDOMAINS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SECURE_HSTS_PRELOAD</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SECURE_HSTS_SECONDS</td> <td class="code"><pre>0</pre></td> </tr> <tr> <td>SECURE_PROXY_SSL_HEADER</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SECURE_REDIRECT_EXEMPT</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>SECURE_REFERRER_POLICY</td> <td class="code"><pre>'same-origin'</pre></td> </tr> <tr> <td>SECURE_SSL_HOST</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SECURE_SSL_REDIRECT</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SERVER_EMAIL</td> <td class="code"><pre>'root@localhost'</pre></td> </tr> <tr> <td>SESSION_CACHE_ALIAS</td> <td class="code"><pre>'default'</pre></td> </tr> <tr> <td>SESSION_COOKIE_AGE</td> <td class="code"><pre>1209600</pre></td> </tr> <tr> <td>SESSION_COOKIE_DOMAIN</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SESSION_COOKIE_HTTPONLY</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>SESSION_COOKIE_NAME</td> <td class="code"><pre>'sessionid'</pre></td> </tr> <tr> <td>SESSION_COOKIE_PATH</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>SESSION_COOKIE_SAMESITE</td> <td class="code"><pre>'Lax'</pre></td> </tr> <tr> <td>SESSION_COOKIE_SECURE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SESSION_ENGINE</td> <td class="code"><pre>'django.contrib.sessions.backends.db'</pre></td> </tr> <tr> <td>SESSION_EXPIRE_AT_BROWSER_CLOSE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SESSION_FILE_PATH</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SESSION_SAVE_EVERY_REQUEST</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SESSION_SERIALIZER</td> <td class="code"><pre>'django.contrib.sessions.serializers.JSONSerializer'</pre></td> </tr> <tr> <td>SETTINGS_MODULE</td> <td class="code"><pre>'DRF.settings'</pre></td> </tr> <tr> <td>SHORT_DATETIME_FORMAT</td> <td class="code"><pre>'m/d/Y P'</pre></td> </tr> <tr> <td>SHORT_DATE_FORMAT</td> <td class="code"><pre>'m/d/Y'</pre></td> </tr> <tr> <td>SIGNING_BACKEND</td> <td class="code"><pre>'django.core.signing.TimestampSigner'</pre></td> </tr> <tr> <td>SILENCED_SYSTEM_CHECKS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>STATICFILES_DIRS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>STATICFILES_FINDERS</td> <td class="code"><pre>['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']</pre></td> </tr> <tr> <td>STATICFILES_STORAGE</td> <td class="code"><pre>'django.contrib.staticfiles.storage.StaticFilesStorage'</pre></td> </tr> <tr> <td>STATIC_ROOT</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>STATIC_URL</td> <td class="code"><pre>'/static/'</pre></td> </tr> <tr> <td>TEMPLATES</td> <td class="code"><pre>[{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'OPTIONS': {'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages']}}]</pre></ td> </tr> <tr> <td>TEST_NON_SERIALIZED_APPS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>TEST_RUNNER</td> <td class="code"><pre>'django.test.runner.DiscoverRunner'</pre></td> </tr> <tr> <td>THOUSAND_SEPARATOR</td> <td class="code"><pre>','</pre></td> </tr> <tr> <td>TIME_FORMAT</td> <td class="code"><pre>'P'</pre></td> </tr> <tr> <td>TIME_INPUT_FORMATS</td> <td class="code"><pre>['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']</pre></td> </tr> <tr> <td>TIME_ZONE</td> <td class="code"><pre>'Asia/Seoul'</pre></td> </tr> <tr> <td>USE_DEPRECATED_PYTZ</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>USE_I18N</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>USE_L10N</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>USE_THOUSAND_SEPARATOR</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>USE_TZ</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>USE_X_FORWARDED_HOST</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>USE_X_FORWARDED_PORT</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>WSGI_APPLICATION</td> <td class="code"><pre>'DRF.wsgi.application'</pre></td> </tr> <tr> <td>X_FRAME_OPTIONS</td> <td class="code"><pre>'DENY'</pre></td> </tr> <tr> <td>YEAR_MONTH_FORMAT</td> <td class="code"><pre>'F Y'</pre></td> </tr> </tbody> </table> </div> <div id="explanation"> (drf) C:\Users\cswoo\OneDrive\Documents\DRF>http POST http://localhost:8000/ukstagram/posts/ message="23th post" is_public=true HTTP/1.1 500 Internal Server Error Content-Length: 125684 Content-Type: text/html Cross-Origin-Opener-Policy: same-origin Date: Fri, 22 Apr 2022 10:48:09 GMT Referrer-Policy: same-origin Server: WSGIServer/0.2 CPython/3.8.12 Vary: Cookie X-Content-Type-Options: nosniff X-Frame-Options: DENY <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="robots" content="NONE,NOARCHIVE"> <title>ValueError at /ukstagram/posts/</title> <style type="text/css"> html * { padding:0; margin:0; } body * { padding:10px 20px; } body * * { padding:0; } body { font:small sans-serif; background-color:#fff; color:#000; } body>div { border-bottom:1px solid #ddd; } h1 { font-weight:normal; } h2 { margin-bottom:.8em; } h3 { margin:1em 0 .5em 0; } h4 { margin:0 0 .5em 0; font-weight: normal; } code, pre { font-size: 100%; white-space: pre-wrap; } summary { cursor: pointer; } table { border:1px solid #ccc; border-collapse: collapse; width:100%; background:white; } tbody td, tbody th { vertical-align:top; padding:2px 3px; } thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; } tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; } table.vars { margin:5px 0 2px 40px; } table.vars td, table.req td { font-family:monospace; } table td.code { width:100%; } table td.code pre { overflow:hidden; } table.source th { color:#666; } table.source td { font-family:monospace; white-space:pre; border-bottom:1px solid #eee; } ul.traceback { list-style-type:none; color: #222; } ul.traceback li.frame { padding-bottom:1em; color:#4f4f4f; } ul.traceback li.user { background-color:#e0e0e0; color:#000 } div.context { padding:10px 0; overflow:hidden; } div.context ol { padding-left:30px; margin:0 10px; list-style-position: inside; } div.context ol li { font-family:monospace; white-space:pre; color:#777; cursor:pointer; padding-left: 2px; } div.context ol li pre { display:inline; } div.context ol.context-line li { color:#464646; background-color:#dfdfdf; padding: 3px 2px; } div.context ol.context-line li span { position:absolute; right:32px; } .user div.context ol.context-line li { background-color:#bbb; color:#000; } .user div.context ol li { color:#666; } div.commands, summary.commands { margin-left: 40px; } div.commands a, summary.commands { color:#555; text-decoration:none; } .user div.commands a { color: black; } #summary { background: #ffc; } #summary h2 { font-weight: normal; color: #666; } #explanation { background:#eee; } #template, #template-not-exist { background:#f6f6f6; } #template-not-exist ul { margin: 0 0 10px 20px; } #template-not-exist .postmortem-section { margin-bottom: 3px; } #unicode-hint { background:#eee; } #traceback { background:#eee; } #requestinfo { background:#f6f6f6; padding-left:120px; } #summary table { border:none; background:transparent; } #requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; } #requestinfo h3 { margin-bottom:-1em; } .error { background: #ffc; } .specific { color:#cc3300; font-weight:bold; } h2 span.commands { font-size:.7em; font-weight:normal; } span.commands a:link {color:#5E5694;} pre.exception_value { font-family: sans-serif; color: #575757; font-size: 1.5em; margin: 10px 0 10px 0; } .append-bottom { margin-bottom: 10px; } .fname { user-select: all; } </style> <script> function hideAll(elems) { for (var e = 0; e < elems.length; e++) { elems[e].style.display = 'none'; } } window.onload = function() { hideAll(document.querySelectorAll('ol.pre-context')); hideAll(document.querySelectorAll('ol.post-context')); hideAll(document.querySelectorAll('div.pastebin')); } function toggle() { for (var i = 0; i < arguments.length; i++) { var e = document.getElementById(arguments[i]); if (e) { e.style.display = e.style.display == 'none' ? 'block': 'none'; } } return false; } function switchPastebinFriendly(link) { s1 = "Switch to copy-and-paste view"; s2 = "Switch back to interactive view"; link.textContent = link.textContent.trim() == s1 ? s2: s1; toggle('browserTraceback', 'pastebinTraceback'); return false; } </script> </head> <body> <div id="summary"> <h1>ValueError at /ukstagram/posts/</h1> <pre class="exception_value">Cannot assign "<django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>": "Post.author" must be a "User" instance.</pre> <table class="meta"> <tr> <th>Request Method:</th> <td>POST</td> </tr> <tr> <th>Request URL:</th> <td>http://localhost:8000/ukstagram/posts/</td> </tr> <tr> <th>Django Version:</th> <td>4.0.4</td> </tr> <tr> <th>Exception Type:</th> <td>ValueError</td> </tr> <tr> <th>Exception Value:</th> <td><pre>Cannot assign "<django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>": "Post.author" must be a "User" instance.</pre></td> </tr> <tr> <th>Exception Location:</th> <td><span class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\fields\related_descriptors.py</span>, line 235, in __set__</td> </tr> <tr> <th>Python Executable:</th> <td>C:\Users\cswoo\.conda\envs\drf\python.exe</td> </tr> <tr> <th>Python Version:</th> <td>3.8.12</td> </tr> <tr> <th>Python Path:</th> <td><pre>['C:\\Users\\cswoo\\OneDrive\\Documents\\DRF', 'C:\\Users\\cswoo\\.conda\\envs\\drf\\python38.zip', 'C:\\Users\\cswoo\\.conda\\envs\\drf\\DLLs', 'C:\\Users\\cswoo\\.conda\\envs\\drf\\lib', 'C:\\Users\\cswoo\\.conda\\envs\\drf', 'C:\\Users\\cswoo\\AppData\\Roaming\\Python\\Python38\\site-packages', 'C:\\Users\\cswoo\\.conda\\envs\\drf\\lib\\site-packages']</pre></td> </tr> <tr> <th>Server time:</th> <td>Fri, 22 Apr 2022 19:48:09 +0900</td> </tr> </table> </div> <div id="traceback"> <h2>Traceback <span class="commands"><a href="#" onclick="return switchPastebinFriendly(this);"> Switch to copy-and-paste view</a></span> </h2> <div id="browserTraceback"> <ul class="traceback"> <li class="frame django"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\core\handlers\exception.py</code>, line 55, in inner <div class="context" id="c1303298475648"> <ol start="48" class="pre-context" id="pre1303298475648"> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre></pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> return inner</pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> else:</pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre></pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> @wraps(get_response)</pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> def inner(request):</pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> try:</pre></li> </ol> <ol start="55" class="context-line"> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> response = get_response(request)</pre> <span>…</span></li> </ol> <ol start='56' class="post-context" id="post1303298475648"> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> except Exception as exc:</pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> response = response_for_exception(request, exc)</pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> return response</pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre></pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre> return inner</pre></li> <li onclick="toggle('pre1303298475648', 'post1303298475648')"><pre></pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303298475648"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>exc</td> <td class="code"><pre>ValueError('Cannot assign "<django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>": "Post.author" must be a "User" instance.')< /pre></td> </tr> <tr> <td>get_response</td> <td class="code"><pre><bound method BaseHandler._get_response of <django.core.handlers.wsgi.WSGIHandler object at 0x0000012F711EE7C0>></pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><WSGIRequest: POST '/ukstagram/posts/'></pre></td> </tr> </tbody> </table> </details> </li> <li class="frame django"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\core\handlers\base.py</code>, line 197, in _get_response <div class="context" id="c1303298474624"> <ol start="190" class="pre-context" id="pre1303298474624"> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre></pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> if response is None:</pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> wrapped_callback = self.make_view_atomic(callback)</pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> # If it is an asynchronous view, run it in a subthread.</pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> if asyncio.iscoroutinefunction(wrapped_callback):</pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> wrapped_callback = async_to_sync(wrapped_callback)</pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> try:</pre></li> </ol> <ol start="197" class="context-line"> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> response = wrapped_callback(request, *callback_args, **callback_kwargs)</pre> <span>…</span></li> </ol> <ol start='198' class="post-context" id="post1303298474624"> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> except Exception as e:</pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> response = self.process_exception_by_middleware(e, request)</pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> if response is None:</pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> raise</pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre></pre></li> <li onclick="toggle('pre1303298474624', 'post1303298474624')"><pre> # Complain if the view returned None (a common error).</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303298474624"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>callback</td> <td class="code"><pre><function PostViewSet at 0x0000012F72648940></pre></td> </tr> <tr> <td>callback_args</td> <td class="code"><pre>()</pre></td> </tr> <tr> <td>callback_kwargs</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>middleware_method</td> <td class="code"><pre><bound method CsrfViewMiddleware.process_view of <CsrfViewMiddleware get_response=convert_exception_to_response.<locals>.inner>></pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><WSGIRequest: POST '/ukstagram/posts/'></pre></td> </tr> <tr> <td>response</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><django.core.handlers.wsgi.WSGIHandler object at 0x0000012F711EE7C0></pre></td> </tr> <tr> <td>wrapped_callback</td> <td class="code"><pre><function PostViewSet at 0x0000012F72648940></pre></td> </tr> </tbody> </table> </details> </li> <li class="frame django"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\views\decorators\csrf.py</code>, line 54, in wrapped_view <div class="context" id="c1303298477888"> <ol start="47" class="pre-context" id="pre1303298477888"> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre></pre></li> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre></pre></li> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre>def csrf_exempt(view_func):</pre></li> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre> """Mark a view function as being exempt from the CSRF view protection."""</pre></li> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre> # view_func.csrf_exempt = True would also work, but decorators are nicer</pre></li> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre> # if they don't have side effects, so return a new function.</pre></li> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre> def wrapped_view(*args, **kwargs):</pre></li> </ol> <ol start="54" class="context-line"> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre> return view_func(*args, **kwargs)</pre> <span>…</span></li> </ol> <ol start='55' class="post-context" id="post1303298477888"> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre></pre></li> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre> wrapped_view.csrf_exempt = True</pre></li> <li onclick="toggle('pre1303298477888', 'post1303298477888')"><pre> return wraps(view_func)(wrapped_view)</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303298477888"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>args</td> <td class="code"><pre>(<WSGIRequest: POST '/ukstagram/posts/'>,)</pre></td> </tr> <tr> <td>kwargs</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>view_func</td> <td class="code"><pre><function PostViewSet at 0x0000012F718C4700></pre></td> </tr> </tbody> </table> </details> </li> <li class="frame user"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\viewsets.py</code>, line 125, in view <div class="context" id="c1303298475328"> <ol start="118" class="pre-context" id="pre1303298475328"> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> setattr(self, method, handler)</pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre></pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> self.request = request</pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> self.args = args</pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> self.kwargs = kwargs</pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre></pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> # And continue as usual</pre></li> </ol> <ol start="125" class="context-line"> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> return self.dispatch(request, *args, **kwargs)</pre> <span>…</span></li> </ol> <ol start='126' class="post-context" id="post1303298475328"> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre></pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> # take name and docstring from class</pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> update_wrapper(view, cls, updated=())</pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre></pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> # and possible attributes set by decorators</pre></li> <li onclick="toggle('pre1303298475328', 'post1303298475328')"><pre> # like csrf_exempt from dispatch</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303298475328"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>action</td> <td class="code"><pre>'list'</pre></td> </tr> <tr> <td>actions</td> <td class="code"><pre>{'get': 'list', 'head': 'list', 'post': 'create'}</pre></td> </tr> <tr> <td>args</td> <td class="code"><pre>()</pre></td> </tr> <tr> <td>cls</td> <td class="code"><pre><class 'ukstagram.views.PostViewSet'></pre></td> </tr> <tr> <td>handler</td> <td class="code"><pre><bound method ListModelMixin.list of <ukstagram.views.PostViewSet object at 0x0000012F72D73520>></pre></td> </tr> <tr> <td>initkwargs</td> <td class="code"><pre>{'basename': 'posts', 'detail': False, 'suffix': 'List'}</pre></td> </tr> <tr> <td>kwargs</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>method</td> <td class="code"><pre>'head'</pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><WSGIRequest: POST '/ukstagram/posts/'></pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><ukstagram.views.PostViewSet object at 0x0000012F72D73520></pre></td> </tr> </tbody> </table> </details> </li> <li class="frame user"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py</code>, line 509, in dispatch <div class="context" id="c1303298477120"> <ol start="502" class="pre-context" id="pre1303298477120"> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> self.http_method_not_allowed)</pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> else:</pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> handler = self.http_method_not_allowed</pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre></pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> response = handler(request, *args, **kwargs)</pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre></pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> except Exception as exc:</pre></li> </ol> <ol start="509" class="context-line"> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> response = self.handle_exception(exc)</pre> <span>…</span></li> </ol> <ol start='510' class="post-context" id="post1303298477120"> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre></pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> self.response = self.finalize_response(request, response, *args, **kwargs)</pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> return self.response</pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre></pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> def options(self, request, *args, **kwargs):</pre></li> <li onclick="toggle('pre1303298477120', 'post1303298477120')"><pre> """</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303298477120"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>args</td> <td class="code"><pre>()</pre></td> </tr> <tr> <td>handler</td> <td class="code"><pre><bound method CreateModelMixin.create of <ukstagram.views.PostViewSet object at 0x0000012F72D73520>></pre></td> </tr> <tr> <td>kwargs</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><rest_framework.request.Request: POST '/ukstagram/posts/'></pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><ukstagram.views.PostViewSet object at 0x0000012F72D73520></pre></td> </tr> </tbody> </table> </details> </li> <li class="frame user"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py</code>, line 469, in handle_exception <div class="context" id="c1303297323328"> <ol start="462" class="pre-context" id="pre1303297323328"> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre></pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre> exception_handler = self.get_exception_handler()</pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre></pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre> context = self.get_exception_handler_context()</pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre> response = exception_handler(exc, context)</pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre></pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre> if response is None:</pre></li> </ol> <ol start="469" class="context-line"> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre> self.raise_uncaught_exception(exc)</pre> <span>…</span></li> </ol> <ol start='470' class="post-context" id="post1303297323328"> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre></pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre> response.exception = True</pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre> return response</pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre></pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre> def raise_uncaught_exception(self, exc):</pre></li> <li onclick="toggle('pre1303297323328', 'post1303297323328')"><pre> if settings.DEBUG:</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303297323328"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>context</td> <td class="code"><pre>{'args': (), 'kwargs': {}, 'request': <rest_framework.request.Request: POST '/ukstagram/posts/'>, 'view': <ukstagram.views.PostViewSet object at 0x0000012F72D73520>}</pre></td> </tr> <tr> <td>exc</td> <td class="code"><pre>ValueError('Cannot assign "<django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>": "Post.author" must be a "User" instance.')< /pre></td> </tr> <tr> <td>exception_handler</td> <td class="code"><pre><function exception_handler at 0x0000012F71E2B9D0></pre></td> </tr> <tr> <td>response</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><ukstagram.views.PostViewSet object at 0x0000012F72D73520></pre></td> </tr> </tbody> </table> </details> </li> <li class="frame user"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py</code>, line 480, in raise_uncaught_exception <div class="context" id="c1303297323776"> <ol start="473" class="pre-context" id="pre1303297323776"> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre></pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> def raise_uncaught_exception(self, exc):</pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> if settings.DEBUG:</pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> request = self.request</pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> renderer_format = getattr(request.accepted_renderer, 'format')</pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> use_plaintext_traceback = renderer_format not in ('html', 'api', 'admin')</pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> request.force_plaintext_errors(use_plaintext_traceback)</pre></li> </ol> <ol start="480" class="context-line"> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> raise exc</pre> <span>…</span></li> </ol> <ol start='481' class="post-context" id="post1303297323776"> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre></pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> # Note: Views are made CSRF exempt from within `as_view` as to prevent</pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> # accidental removal of this exemption in cases where `dispatch` needs to</pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> # be overridden.</pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> def dispatch(self, request, *args, **kwargs):</pre></li> <li onclick="toggle('pre1303297323776', 'post1303297323776')"><pre> """</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303297323776"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>exc</td> <td class="code"><pre>ValueError('Cannot assign "<django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>": "Post.author" must be a "User" instance.')< /pre></td> </tr> <tr> <td>renderer_format</td> <td class="code"><pre>'json'</pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><rest_framework.request.Request: POST '/ukstagram/posts/'></pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><ukstagram.views.PostViewSet object at 0x0000012F72D73520></pre></td> </tr> <tr> <td>use_plaintext_traceback</td> <td class="code"><pre>True</pre></td> </tr> </tbody> </table> </details> </li> <li class="frame user"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py</code>, line 506, in dispatch <div class="context" id="c1303297323136"> <ol start="499" class="pre-context" id="pre1303297323136"> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> # Get the appropriate handler method</pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> if request.method.lower() in self.http_method_names:</pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> handler = getattr(self, request.method.lower(),</pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> self.http_method_not_allowed)</pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> else:</pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> handler = self.http_method_not_allowed</pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre></pre></li> </ol> <ol start="506" class="context-line"> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> response = handler(request, *args, **kwargs)</pre> <span>…</span></li> </ol> <ol start='507' class="post-context" id="post1303297323136"> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre></pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> except Exception as exc:</pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> response = self.handle_exception(exc)</pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre></pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> self.response = self.finalize_response(request, response, *args, **kwargs)</pre></li> <li onclick="toggle('pre1303297323136', 'post1303297323136')"><pre> return self.response</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303297323136"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>args</td> <td class="code"><pre>()</pre></td> </tr> <tr> <td>handler</td> <td class="code"><pre><bound method CreateModelMixin.create of <ukstagram.views.PostViewSet object at 0x0000012F72D73520>></pre></td> </tr> <tr> <td>kwargs</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><rest_framework.request.Request: POST '/ukstagram/posts/'></pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><ukstagram.views.PostViewSet object at 0x0000012F72D73520></pre></td> </tr> </tbody> </table> </details> </li> <li class="frame user"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\mixins.py</code>, line 19, in create <div class="context" id="c1303297323456"> <ol start="12" class="pre-context" id="pre1303297323456"> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre>class CreateModelMixin:</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> """</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> Create a model instance.</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> """</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> def create(self, request, *args, **kwargs):</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> serializer = self.get_serializer(data=request.data)</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> serializer.is_valid(raise_exception=True)</pre></li> </ol> <ol start="19" class="context-line"> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> self.perform_create(serializer)</pre> <span>…</span></li> </ol> <ol start='20' class="post-context" id="post1303297323456"> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> headers = self.get_success_headers(serializer.data)</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre></pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> def perform_create(self, serializer):</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre> serializer.save()</pre></li> <li onclick="toggle('pre1303297323456', 'post1303297323456')"><pre></pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303297323456"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>args</td> <td class="code"><pre>()</pre></td> </tr> <tr> <td>kwargs</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><rest_framework.request.Request: POST '/ukstagram/posts/'></pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><ukstagram.views.PostViewSet object at 0x0000012F72D73520></pre></td> </tr> <tr> <td>serializer</td> <td class="code"><pre>PostSerializer(context={'request': <rest_framework.request.Request: POST '/ukstagram/posts/'>, 'format': None, 'view': <ukstagram.views.PostV iewSet object>}, data={'message': '23th post', 'is_public': 'true'}): pk = IntegerField(label='ID', read_only=True) username = ReadOnlyField(source='author.username') message = CharField(style={'base_template': 'textarea.html'}) created_at = DateTimeField(read_only=True) updated_at = DateTimeField(read_only=True) is_public = BooleanField(required=False)</pre></td> </tr> </tbody> </table> </details> </li> <li class="frame user"> <code class="fname">C:\Users\cswoo\OneDrive\Documents\DRF\ukstagram\views.py</code>, line 46, in perform_create <div class="context" id="c1303297326656"> <ol start="39" class="pre-context" id="pre1303297326656"> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> # serializer = self.get_serializer(data=request.data)</pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> # if serializer.is_valid():</pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> # serializer.save(author=request.user)</pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> # return Response(serializer.data, status=status.HTTP_201_CREATED)</pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> # return Response(status=status.HTTP_400_BAD_REQUEST)</pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre></pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> def perform_create(self, serializer):</pre></li> </ol> <ol start="46" class="context-line"> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> serializer.save(author=self.request.user)</pre> <span>…</span></li> </ol> <ol start='47' class="post-context" id="post1303297326656"> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre></pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> @action(detail=False, methods=['GET'])</pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> def public(self, request):</pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> qs = self.get_queryset().filter(is_public=True)</pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> serializer = self.get_serializer(instance=qs, many=True)</pre></li> <li onclick="toggle('pre1303297326656', 'post1303297326656')"><pre> return Response(serializer.data)</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303297326656"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>self</td> <td class="code"><pre><ukstagram.views.PostViewSet object at 0x0000012F72D73520></pre></td> </tr> <tr> <td>serializer</td> <td class="code"><pre>PostSerializer(context={'request': <rest_framework.request.Request: POST '/ukstagram/posts/'>, 'format': None, 'view': <ukstagram.views.PostV iewSet object>}, data={'message': '23th post', 'is_public': 'true'}): pk = IntegerField(label='ID', read_only=True) username = ReadOnlyField(source='author.username') message = CharField(style={'base_template': 'textarea.html'}) created_at = DateTimeField(read_only=True) updated_at = DateTimeField(read_only=True) is_public = BooleanField(required=False)</pre></td> </tr> </tbody> </table> </details> </li> <li class="frame user"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\serializers.py</code>, line 212, in save <div class="context" id="c1303297323584"> <ol start="205" class="pre-context" id="pre1303297323584"> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre></pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> if self.instance is not None:</pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> self.instance = self.update(self.instance, validated_data)</pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> assert self.instance is not None, (</pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> '`update()` did not return an object instance.'</pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> )</pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> else:</pre></li> </ol> <ol start="212" class="context-line"> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> self.instance = self.create(validated_data)</pre> <span>…</span></li> </ol> <ol start='213' class="post-context" id="post1303297323584"> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> assert self.instance is not None, (</pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> '`create()` did not return an object instance.'</pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> )</pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre></pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre> return self.instance</pre></li> <li onclick="toggle('pre1303297323584', 'post1303297323584')"><pre></pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303297323584"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>kwargs</td> <td class="code"><pre>{'author': <django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>}</pre></td> </tr> <tr> <td>self</td> <td class="code"><pre>PostSerializer(context={'request': <rest_framework.request.Request: POST '/ukstagram/posts/'>, 'format': None, 'view': <ukstagram.views.PostV iewSet object>}, data={'message': '23th post', 'is_public': 'true'}): pk = IntegerField(label='ID', read_only=True) username = ReadOnlyField(source='author.username') message = CharField(style={'base_template': 'textarea.html'}) created_at = DateTimeField(read_only=True) updated_at = DateTimeField(read_only=True) is_public = BooleanField(required=False)</pre></td> </tr> <tr> <td>validated_data</td> <td class="code"><pre>{'author': <django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>, 'is_public': True, 'message': '23th post'}</pre></td> </tr> </tbody> </table> </details> </li> <li class="frame user"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\serializers.py</code>, line 962, in create <div class="context" id="c1303297326272"> <ol start="955" class="pre-context" id="pre1303297326272"> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> info = model_meta.get_field_info(ModelClass)</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> many_to_many = {}</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> for field_name, relation_info in info.relations.items():</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> if relation_info.to_many and (field_name in validated_data):</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> many_to_many[field_name] = validated_data.pop(field_name)</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre></pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> try:</pre></li> </ol> <ol start="962" class="context-line"> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> instance = ModelClass._default_manager.create(**validated_data)</pre> <span>…</span></li> </ol> <ol start='963' class="post-context" id="post1303297326272"> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> except TypeError:</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> tb = traceback.format_exc()</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> msg = (</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> 'Got a `TypeError` when calling `%s.%s.create()`. '</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> 'This may be because you have a writable field on the '</pre></li> <li onclick="toggle('pre1303297326272', 'post1303297326272')"><pre> 'serializer class that is not a valid argument to '</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303297326272"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>ModelClass</td> <td class="code"><pre><class 'ukstagram.models.Post'></pre></td> </tr> <tr> <td>field_name</td> <td class="code"><pre>'author'</pre></td> </tr> <tr> <td>info</td> <td class="code"><pre>FieldResult(pk=<django.db.models.fields.BigAutoField: id>, fields=OrderedDict([('message', <django.db.models.fields.TextField: message>), ('created_at', <d jango.db.models.fields.DateTimeField: created_at>), ('updated_at', <django.db.models.fields.DateTimeField: updated_at>), ('is_public', <django.db.models.fields.BooleanField: is_public>)]), forward_ relations=OrderedDict([('author', RelationInfo(model_field=<django.db.models.fields.related.ForeignKey: author>, related_model=<class 'django.contrib.auth.models.User'>, to_many=False, to_field=None, has_through_model=False, reverse=False))]), reverse_relations=OrderedDict(), fields_and_pk=OrderedDict([('pk', <django.db.models.fields.BigAutoField: id>), ('id', <django.db.models.fields.BigAutoField: i d>), ('message', <django.db.models.fields.TextField: message>), ('created_at', <django.db.models.fields.DateTimeField: created_at>), ('updated_at', <django.db.models.fields.DateTimeFie ld: updated_at>), ('is_public', <django.db.models.fields.BooleanField: is_public>)]), relations=OrderedDict([('author', RelationInfo(model_field=<django.db.models.fields.related.ForeignKey: author> , related_model=<class 'django.contrib.auth.models.User'>, to_many=False, to_field=None, has_through_model=False, reverse=False))]))</pre></td> </tr> <tr> <td>many_to_many</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>relation_info</td> <td class="code"><pre>RelationInfo(model_field=<django.db.models.fields.related.ForeignKey: author>, related_model=<class 'django.contrib.auth.models.User'>, to_many=False, to_field=None, ha s_through_model=False, reverse=False)</pre></td> </tr> <tr> <td>self</td> <td class="code"><pre>PostSerializer(context={'request': <rest_framework.request.Request: POST '/ukstagram/posts/'>, 'format': None, 'view': <ukstagram.views.PostV iewSet object>}, data={'message': '23th post', 'is_public': 'true'}): pk = IntegerField(label='ID', read_only=True) username = ReadOnlyField(source='author.username') message = CharField(style={'base_template': 'textarea.html'}) created_at = DateTimeField(read_only=True) updated_at = DateTimeField(read_only=True) is_public = BooleanField(required=False)</pre></td> </tr> <tr> <td>validated_data</td> <td class="code"><pre>{'author': <django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>, 'is_public': True, 'message': '23th post'}</pre></td> </tr> </tbody> </table> </details> </li> <li class="frame django"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\manager.py</code>, line 85, in manager_method <div class="context" id="c1303297323072"> <ol start="78" class="pre-context" id="pre1303297323072"> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> def check(self, **kwargs):</pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> return []</pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre></pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> @classmethod</pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> def _get_queryset_methods(cls, queryset_class):</pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> def create_method(name, method):</pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> def manager_method(self, *args, **kwargs):</pre></li> </ol> <ol start="85" class="context-line"> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> return getattr(self.get_queryset(), name)(*args, **kwargs)</pre> <span>…</span></li> </ol> <ol start='86' class="post-context" id="post1303297323072"> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre></pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> manager_method.__name__ = method.__name__</pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> manager_method.__doc__ = method.__doc__</pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> return manager_method</pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre></pre></li> <li onclick="toggle('pre1303297323072', 'post1303297323072')"><pre> new_methods = {}</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303297323072"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>args</td> <td class="code"><pre>()</pre></td> </tr> <tr> <td>kwargs</td> <td class="code"><pre>{'author': <django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>, 'is_public': True, 'message': '23th post'}</pre></td> </tr> <tr> <td>name</td> <td class="code"><pre>'create'</pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><django.db.models.manager.Manager object at 0x0000012F726530D0></pre></td> </tr> </tbody> </table> </details> </li> <li class="frame django"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\query.py</code>, line 512, in create <div class="context" id="c1303301874176"> <ol start="505" class="pre-context" id="pre1303301874176"> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> )</pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre></pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> def create(self, **kwargs):</pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> """</pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> Create a new object with the given kwargs, saving it to the database</pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> and returning the created object.</pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> """</pre></li> </ol> <ol start="512" class="context-line"> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> obj = self.model(**kwargs)</pre> <span>…</span></li> </ol> <ol start='513' class="post-context" id="post1303301874176"> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> self._for_write = True</pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> obj.save(force_insert=True, using=self.db)</pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> return obj</pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre></pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> def _prepare_for_bulk_create(self, objs):</pre></li> <li onclick="toggle('pre1303301874176', 'post1303301874176')"><pre> for obj in objs:</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303301874176"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>kwargs</td> <td class="code"><pre>{'author': <django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>, 'is_public': True, 'message': '23th post'}</pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><QuerySet [<Post: Post object (1)>, <Post: Post object (2)>, <Post: Post object (3)>, <Post: Post object (4)>, <Post: Post object (5)>, <Post: Post object (6)>, <Post: Post object (7)>, <Post: Post object (8)>, <Post: Post object (10)>, <Post: Post object (11)>, <Post: Post object (12)>, <Post: Post object (13)>, <Post: Post object (14)>, <Post: Post object (15)>, <Post: Post object (16)>, <Post: Post object (17)>, <Post: Post object (18)>, <Post: Post object (19)>, <Post: Post object (20)>, <Post: Post object (21)>, '.. .(remaining elements truncated)...']></pre></td> </tr> </tbody> </table> </details> </li> <li class="frame django"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\base.py</code>, line 541, in __init__ <div class="context" id="c1303301877120"> <ol start="534" class="pre-context" id="pre1303301877120"> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre></pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> if is_related_object:</pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> # If we are passed a related instance, set it using the</pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> # field.name instead of field.attname (e.g. "user" instead of</pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> # "user_id") so that the object gets properly cached (and type</pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> # checked) by the RelatedObjectDescriptor.</pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> if rel_obj is not _DEFERRED:</pre></li> </ol> <ol start="541" class="context-line"> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> _setattr(self, field.name, rel_obj)</pre> <span>…</span></li> </ol> <ol start='542' class="post-context" id="post1303301877120"> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> else:</pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> if val is not _DEFERRED:</pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> _setattr(self, field.attname, val)</pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre></pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> if kwargs:</pre></li> <li onclick="toggle('pre1303301877120', 'post1303301877120')"><pre> property_names = opts._property_names</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303301877120"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>_DEFERRED</td> <td class="code"><pre><Deferred field></pre></td> </tr> <tr> <td>__class__</td> <td class="code"><pre><class 'django.db.models.base.Model'></pre></td> </tr> <tr> <td>_setattr</td> <td class="code"><pre><built-in function setattr></pre></td> </tr> <tr> <td>args</td> <td class="code"><pre>()</pre></td> </tr> <tr> <td>cls</td> <td class="code"><pre><class 'ukstagram.models.Post'></pre></td> </tr> <tr> <td>field</td> <td class="code"><pre><django.db.models.fields.related.ForeignKey: author></pre></td> </tr> <tr> <td>fields_iter</td> <td class="code"><pre><tuple_iterator object at 0x0000012F72D73D60></pre></td> </tr> <tr> <td>is_related_object</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>kwargs</td> <td class="code"><pre>{'is_public': True, 'message': '23th post'}</pre></td> </tr> <tr> <td>opts</td> <td class="code"><pre><Options for Post></pre></td> </tr> <tr> <td>rel_obj</td> <td class="code"><pre><django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10></pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><Post: Post object (None)></pre></td> </tr> <tr> <td>val</td> <td class="code"><pre>None</pre></td> </tr> </tbody> </table> </details> </li> <li class="frame django"> <code class="fname">C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\fields\related_descriptors.py</code>, line 235, in __set__ <div class="context" id="c1303301876544"> <ol start="228" class="pre-context" id="pre1303301876544"> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> - ``instance`` is the ``child`` instance</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> - ``value`` is the ``parent`` instance on the right of the equal sign</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> """</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> # An object must be an instance of the related class.</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> if value is not None and not isinstance(</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> value, self.field.remote_field.model._meta.concrete_model</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> ):</pre></li> </ol> <ol start="235" class="context-line"> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> raise ValueError(</pre> <span>…</span></li> </ol> <ol start='236' class="post-context" id="post1303301876544"> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> 'Cannot assign "%r": "%s.%s" must be a "%s" instance.'</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> % (</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> value,</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> instance._meta.object_name,</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> self.field.name,</pre></li> <li onclick="toggle('pre1303301876544', 'post1303301876544')"><pre> self.field.remote_field.model._meta.object_name,</pre></li> </ol> </div> <details> <summary class="commands">Local vars</summary> <table class="vars" id="v1303301876544"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>instance</td> <td class="code"><pre><Post: Post object (None)></pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><django.db.models.fields.related_descriptors.ForwardManyToOneDescriptor object at 0x0000012F717A5670></pre></td> </tr> <tr> <td>value</td> <td class="code"><pre><django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10></pre></td> </tr> </tbody> </table> </details> </li> </ul> </div> <form action="https://dpaste.com/" name="pasteform" id="pasteform" method="post"> <div id="pastebinTraceback" class="pastebin"> <input type="hidden" name="language" value="PythonConsole"> <input type="hidden" name="title" value="ValueError at /ukstagram/posts/"> <input type="hidden" name="source" value="Django Dpaste Agent"> <input type="hidden" name="poster" value="Django"> <textarea name="content" id="traceback_area" cols="140" rows="25"> Environment: Request Method: POST Request URL: http://localhost:8000/ukstagram/posts/ Django Version: 4.0.4 Python Version: 3.8.12 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'ukstagram'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback (most recent call last): File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\core\handlers\exception.py", line 55, in inner response = get_response(request) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\viewsets.py", line 125, in view return self.dispatch(request, *args, **kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py", line 509, in dispatch response = self.handle_exception(exc) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception raise exc File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\mixins.py", line 19, in create self.perform_create(serializer) File "C:\Users\cswoo\OneDrive\Documents\DRF\ukstagram\views.py", line 46, in perform_create serializer.save(author=self.request.user) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\serializers.py", line 212, in save self.instance = self.create(validated_data) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\rest_framework\serializers.py", line 962, in create instance = ModelClass._default_manager.create(**validated_data) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\query.py", line 512, in create obj = self.model(**kwargs) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\base.py", line 541, in __init__ _setattr(self, field.name, rel_obj) File "C:\Users\cswoo\.conda\envs\drf\lib\site-packages\django\db\models\fields\related_descriptors.py", line 235, in __set__ raise ValueError( Exception Type: ValueError at /ukstagram/posts/ Exception Value: Cannot assign "<django.contrib.auth.models.AnonymousUser object at 0x0000012F72D73C10>": "Post.author" must be a "User" instance. </textarea> <br><br> <input type="submit" value="Share this traceback on a public website"> </div> </form> </div> <div id="requestinfo"> <h2>Request information</h2> <h3 id="user-info">USER</h3> <p>AnonymousUser</p> <h3 id="get-info">GET</h3> <p>No GET data</p> <h3 id="post-info">POST</h3> <p>No POST data</p> <h3 id="files-info">FILES</h3> <p>No FILES data</p> <h3 id="cookie-info">COOKIES</h3> <p>No cookie data</p> <h3 id="meta-info">META</h3> <table class="req"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>ALLUSERSPROFILE</td> <td class="code"><pre>'C:\\ProgramData'</pre></td> </tr> <tr> <td>APPDATA</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Roaming'</pre></td> </tr> <tr> <td>CLSID</td> <td class="code"><pre>'{290BFAA9-A9FC-AD78-7B4F-4803F0742CCA}'</pre></td> </tr> <tr> <td>COMMONPROGRAMFILES</td> <td class="code"><pre>'C:\\Program Files\\Common Files'</pre></td> </tr> <tr> <td>COMMONPROGRAMFILES(X86)</td> <td class="code"><pre>'C:\\Program Files (x86)\\Common Files'</pre></td> </tr> <tr> <td>COMMONPROGRAMW6432</td> <td class="code"><pre>'C:\\Program Files\\Common Files'</pre></td> </tr> <tr> <td>COMPUTERNAME</td> <td class="code"><pre>'DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>COMSPEC</td> <td class="code"><pre>'C:\\WINDOWS\\system32\\cmd.exe'</pre></td> </tr> <tr> <td>CONDA_DEFAULT_ENV</td> <td class="code"><pre>'drf'</pre></td> </tr> <tr> <td>CONDA_PREFIX</td> <td class="code"><pre>'C:\\Users\\cswoo\\.conda\\envs\\drf'</pre></td> </tr> <tr> <td>CONDA_PROMPT_MODIFIER</td> <td class="code"><pre>'(drf) '</pre></td> </tr> <tr> <td>CONDA_SHLVL</td> <td class="code"><pre>'1'</pre></td> </tr> <tr> <td>CONTENT_LENGTH</td> <td class="code"><pre>'45'</pre></td> </tr> <tr> <td>CONTENT_TYPE</td> <td class="code"><pre>'application/json'</pre></td> </tr> <tr> <td>DJANGO_SETTINGS_MODULE</td> <td class="code"><pre>'DRF.settings'</pre></td> </tr> <tr> <td>DRIVERDATA</td> <td class="code"><pre>'C:\\Windows\\System32\\Drivers\\DriverData'</pre></td> </tr> <tr> <td>FPS_BROWSER_APP_PROFILE_STRING</td> <td class="code"><pre>'Internet Explorer'</pre></td> </tr> <tr> <td>FPS_BROWSER_USER_PROFILE_STRING</td> <td class="code"><pre>'Default'</pre></td> </tr> <tr> <td>GATEWAY_INTERFACE</td> <td class="code"><pre>'CGI/1.1'</pre></td> </tr> <tr> <td>GOOGLE_API_KEY</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>GOOGLE_DEFAULT_CLIENT_ID</td> <td class="code"><pre>'no'</pre></td> </tr> <tr> <td>GOOGLE_DEFAULT_CLIENT_SECRET</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>HOMEDRIVE</td> <td class="code"><pre>'C:'</pre></td> </tr> <tr> <td>HOMEPATH</td> <td class="code"><pre>'\\Users\\cswoo'</pre></td> </tr> <tr> <td>HTTP_ACCEPT</td> <td class="code"><pre>'application/json, */*;q=0.5'</pre></td> </tr> <tr> <td>HTTP_ACCEPT_ENCODING</td> <td class="code"><pre>'gzip, deflate'</pre></td> </tr> <tr> <td>HTTP_CONNECTION</td> <td class="code"><pre>'keep-alive'</pre></td> </tr> <tr> <td>HTTP_HOST</td> <td class="code"><pre>'localhost:8000'</pre></td> </tr> <tr> <td>HTTP_USER_AGENT</td> <td class="code"><pre>'HTTPie/3.1.0'</pre></td> </tr> <tr> <td>IDEA_INITIAL_DIRECTORY</td> <td class="code"><pre>'C:\\Users\\cswoo\\OneDrive\\Documents'</pre></td> </tr> <tr> <td>LOCALAPPDATA</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Local'</pre></td> </tr> <tr> <td>LOGONSERVER</td> <td class="code"><pre>'\\\\DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>NUMBER_OF_PROCESSORS</td> <td class="code"><pre>'6'</pre></td> </tr> <tr> <td>ONEDRIVE</td> <td class="code"><pre>'C:\\Users\\cswoo\\OneDrive'</pre></td> </tr> <tr> <td>ONEDRIVECONSUMER</td> <td class="code"><pre>'C:\\Users\\cswoo\\OneDrive'</pre></td> </tr> <tr> <td>OS</td> <td class="code"><pre>'Windows_NT'</pre></td> </tr> <tr> <td>PATH</td> <td class="code"><pre>('C:\\Users\\cswoo\\.conda\\envs\\drf;C:\\Users\\cswoo\\.conda\\envs\\drf\\Library\\mingw-w64\\bin;C:\\Users\\cswoo\\.conda\\envs\\drf\\Library\\usr\\bin;C:\\Users\\cswoo\\.conda\\envs\\drf\\Libr ary\\bin;C:\\Users\\cswoo\\.conda\\envs\\drf\\Scripts;C:\\Users\\cswoo\\.conda\\envs\\drf\\bin;C:\\ProgramData\\Anaconda3\\condabin;C:\\ProgramData\\Anaconda3;C:\\ProgramData\\Anaconda3\\Library\\mingw-w64\\bin;C:\\ProgramData\\Anac onda3\\Library\\usr\\bin;C:\\ProgramData\\Anaconda3\\Library\\bin;C:\\ProgramData\\Anaconda3\\Scripts;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0;C:\\WINDOWS\\System32 \\OpenSSH;C:\\Program ' 'Files\\Git\\cmd;C:\\Users\\cswoo\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\cswoo\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program ' 'Files\\JetBrains\\PyCharm Community Edition ' '2021.2.2\\bin;.;C:\\Users\\cswoo\\AppData\\Local\\afreeca;C:\\Users\\cswoo\\AppData\\Local\\Programs\\Microsoft ' 'VS Code\\bin;C:\\Program Files\\JetBrains\\PyCharm 2021.3.3\\bin;.')</pre></td> </tr> <tr> <td>PATHEXT</td> <td class="code"><pre>'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'</pre></td> </tr> <tr> <td>PATH_INFO</td> <td class="code"><pre>'/ukstagram/posts/'</pre></td> </tr> <tr> <td>PROCESSOR_ARCHITECTURE</td> <td class="code"><pre>'AMD64'</pre></td> </tr> <tr> <td>PROCESSOR_IDENTIFIER</td> <td class="code"><pre>'Intel64 Family 6 Model 158 Stepping 10, GenuineIntel'</pre></td> </tr> <tr> <td>PROCESSOR_LEVEL</td> <td class="code"><pre>'6'</pre></td> </tr> <tr> <td>PROCESSOR_REVISION</td> <td class="code"><pre>'9e0a'</pre></td> </tr> <tr> <td>PROGRAMDATA</td> <td class="code"><pre>'C:\\ProgramData'</pre></td> </tr> <tr> <td>PROGRAMFILES</td> <td class="code"><pre>'C:\\Program Files'</pre></td> </tr> <tr> <td>PROGRAMFILES(X86)</td> <td class="code"><pre>'C:\\Program Files (x86)'</pre></td> </tr> <tr> <td>PROGRAMW6432</td> <td class="code"><pre>'C:\\Program Files'</pre></td> </tr> <tr> <td>PROMPT</td> <td class="code"><pre>'(drf) $P$G'</pre></td> </tr> <tr> <td>PSMODULEPATH</td> <td class="code"><pre>('C:\\Program ' 'Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules')</pre></td> </tr> <tr> <td>PUBLIC</td> <td class="code"><pre>'C:\\Users\\Public'</pre></td> </tr> <tr> <td>PYCHARM</td> <td class="code"><pre>'C:\\Program Files\\JetBrains\\PyCharm 2021.3.3\\bin;'</pre></td> </tr> <tr> <td>PYCHARM COMMUNITY EDITION</td> <td class="code"><pre>'C:\\Program Files\\JetBrains\\PyCharm Community Edition 2021.2.2\\bin;'</pre></td> </tr> <tr> <td>PYTHONIOENCODING</td> <td class="code"><pre>'utf-8'</pre></td> </tr> <tr> <td>QUERY_STRING</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>REMOTE_ADDR</td> <td class="code"><pre>'127.0.0.1'</pre></td> </tr> <tr> <td>REMOTE_HOST</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>REQUEST_METHOD</td> <td class="code"><pre>'POST'</pre></td> </tr> <tr> <td>RUN_MAIN</td> <td class="code"><pre>'true'</pre></td> </tr> <tr> <td>SCRIPT_NAME</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>SERVER_NAME</td> <td class="code"><pre>'DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>SERVER_PORT</td> <td class="code"><pre>'8000'</pre></td> </tr> <tr> <td>SERVER_PROTOCOL</td> <td class="code"><pre>'HTTP/1.1'</pre></td> </tr> <tr> <td>SERVER_SOFTWARE</td> <td class="code"><pre>'WSGIServer/0.2'</pre></td> </tr> <tr> <td>SESSIONNAME</td> <td class="code"><pre>'Console'</pre></td> </tr> <tr> <td>SYSTEMDRIVE</td> <td class="code"><pre>'C:'</pre></td> </tr> <tr> <td>SYSTEMROOT</td> <td class="code"><pre>'C:\\WINDOWS'</pre></td> </tr> <tr> <td>TEMP</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Local\\Temp'</pre></td> </tr> <tr> <td>TERMINAL_EMULATOR</td> <td class="code"><pre>'JetBrains-JediTerm'</pre></td> </tr> <tr> <td>TERM_SESSION_ID</td> <td class="code"><pre>'8e1c69ed-565b-4df9-abcb-4027930ba073'</pre></td> </tr> <tr> <td>TMP</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Local\\Temp'</pre></td> </tr> <tr> <td>USERDOMAIN</td> <td class="code"><pre>'DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>USERDOMAIN_ROAMINGPROFILE</td> <td class="code"><pre>'DESKTOP-9D39MMH'</pre></td> </tr> <tr> <td>USERNAME</td> <td class="code"><pre>'cswoo'</pre></td> </tr> <tr> <td>USERPROFILE</td> <td class="code"><pre>'C:\\Users\\cswoo'</pre></td> </tr> <tr> <td>WINDIR</td> <td class="code"><pre>'C:\\WINDOWS'</pre></td> </tr> <tr> <td>__INTELLIJ_COMMAND_HISTFILE__</td> <td class="code"><pre>'C:\\Users\\cswoo\\AppData\\Local\\JetBrains\\PyCharm2021.3\\terminal\\history\\DRF-history'</pre></td> </tr> <tr> <td>wsgi.errors</td> <td class="code"><pre><colorama.ansitowin32.StreamWrapper object at 0x0000012F70805610></pre></td> </tr> <tr> <td>wsgi.file_wrapper</td> <td class="code"><pre><class 'wsgiref.util.FileWrapper'></pre></td> </tr> <tr> <td>wsgi.input</td> <td class="code"><pre><django.core.handlers.wsgi.LimitedStream object at 0x0000012F729DC190></pre></td> </tr> <tr> <td>wsgi.multiprocess</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>wsgi.multithread</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>wsgi.run_once</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>wsgi.url_scheme</td> <td class="code"><pre>'http'</pre></td> </tr> <tr> <td>wsgi.version</td> <td class="code"><pre>(1, 0)</pre></td> </tr> </tbody> </table> <h3 id="settings-info">Settings</h3> <h4>Using settings module <code>DRF.settings</code></h4> <table class="req"> <thead> <tr> <th>Setting</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>ABSOLUTE_URL_OVERRIDES</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>ADMINS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>ALLOWED_HOSTS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>APPEND_SLASH</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>AUTHENTICATION_BACKENDS</td> <td class="code"><pre>['django.contrib.auth.backends.ModelBackend']</pre></td> </tr> <tr> <td>AUTH_PASSWORD_VALIDATORS</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>AUTH_USER_MODEL</td> <td class="code"><pre>'auth.User'</pre></td> </tr> <tr> <td>BASE_DIR</td> <td class="code"><pre>WindowsPath('C:/Users/cswoo/OneDrive/Documents/DRF')</pre></td> </tr> <tr> <td>CACHES</td> <td class="code"><pre>{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}</pre></td> </tr> <tr> <td>CACHE_MIDDLEWARE_ALIAS</td> <td class="code"><pre>'default'</pre></td> </tr> <tr> <td>CACHE_MIDDLEWARE_KEY_PREFIX</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>CACHE_MIDDLEWARE_SECONDS</td> <td class="code"><pre>600</pre></td> </tr> <tr> <td>CSRF_COOKIE_AGE</td> <td class="code"><pre>31449600</pre></td> </tr> <tr> <td>CSRF_COOKIE_DOMAIN</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>CSRF_COOKIE_HTTPONLY</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>CSRF_COOKIE_NAME</td> <td class="code"><pre>'csrftoken'</pre></td> </tr> <tr> <td>CSRF_COOKIE_PATH</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>CSRF_COOKIE_SAMESITE</td> <td class="code"><pre>'Lax'</pre></td> </tr> <tr> <td>CSRF_COOKIE_SECURE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>CSRF_FAILURE_VIEW</td> <td class="code"><pre>'django.views.csrf.csrf_failure'</pre></td> </tr> <tr> <td>CSRF_HEADER_NAME</td> <td class="code"><pre>'HTTP_X_CSRFTOKEN'</pre></td> </tr> <tr> <td>CSRF_TRUSTED_ORIGINS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>CSRF_USE_SESSIONS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>DATABASES</td> <td class="code"><pre>{'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': WindowsPath('C:/Users/cswoo/OneDrive/Documents/DRF/db.sqlite3'), 'OPTIONS': {}, 'PASSWORD': '********************', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': ''}}</pre></td> </tr> <tr> <td>DATABASE_ROUTERS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>DATA_UPLOAD_MAX_MEMORY_SIZE</td> <td class="code"><pre>2621440</pre></td> </tr> <tr> <td>DATA_UPLOAD_MAX_NUMBER_FIELDS</td> <td class="code"><pre>1000</pre></td> </tr> <tr> <td>DATETIME_FORMAT</td> <td class="code"><pre>'N j, Y, P'</pre></td> </tr> <tr> <td>DATETIME_INPUT_FORMATS</td> <td class="code"><pre>['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M']</pre></td> </tr> <tr> <td>DATE_FORMAT</td> <td class="code"><pre>'N j, Y'</pre></td> </tr> <tr> <td>DATE_INPUT_FORMATS</td> <td class="code"><pre>['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']</pre></td> </tr> <tr> <td>DEBUG</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>DEBUG_PROPAGATE_EXCEPTIONS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>DECIMAL_SEPARATOR</td> <td class="code"><pre>'.'</pre></td> </tr> <tr> <td>DEFAULT_AUTO_FIELD</td> <td class="code"><pre>'django.db.models.BigAutoField'</pre></td> </tr> <tr> <td>DEFAULT_CHARSET</td> <td class="code"><pre>'utf-8'</pre></td> </tr> <tr> <td>DEFAULT_EXCEPTION_REPORTER</td> <td class="code"><pre>'django.views.debug.ExceptionReporter'</pre></td> </tr> <tr> <td>DEFAULT_EXCEPTION_REPORTER_FILTER</td> <td class="code"><pre>'django.views.debug.SafeExceptionReporterFilter'</pre></td> </tr> <tr> <td>DEFAULT_FILE_STORAGE</td> <td class="code"><pre>'django.core.files.storage.FileSystemStorage'</pre></td> </tr> <tr> <td>DEFAULT_FROM_EMAIL</td> <td class="code"><pre>'webmaster@localhost'</pre></td> </tr> <tr> <td>DEFAULT_INDEX_TABLESPACE</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>DEFAULT_TABLESPACE</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>DISALLOWED_USER_AGENTS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>EMAIL_BACKEND</td> <td class="code"><pre>'django.core.mail.backends.smtp.EmailBackend'</pre></td> </tr> <tr> <td>EMAIL_HOST</td> <td class="code"><pre>'localhost'</pre></td> </tr> <tr> <td>EMAIL_HOST_PASSWORD</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>EMAIL_HOST_USER</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>EMAIL_PORT</td> <td class="code"><pre>25</pre></td> </tr> <tr> <td>EMAIL_SSL_CERTFILE</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>EMAIL_SSL_KEYFILE</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>EMAIL_SUBJECT_PREFIX</td> <td class="code"><pre>'[Django] '</pre></td> </tr> <tr> <td>EMAIL_TIMEOUT</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>EMAIL_USE_LOCALTIME</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>EMAIL_USE_SSL</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>EMAIL_USE_TLS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>FILE_UPLOAD_DIRECTORY_PERMISSIONS</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FILE_UPLOAD_HANDLERS</td> <td class="code"><pre>['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']</pre></td> </tr> <tr> <td>FILE_UPLOAD_MAX_MEMORY_SIZE</td> <td class="code"><pre>2621440</pre></td> </tr> <tr> <td>FILE_UPLOAD_PERMISSIONS</td> <td class="code"><pre>420</pre></td> </tr> <tr> <td>FILE_UPLOAD_TEMP_DIR</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FIRST_DAY_OF_WEEK</td> <td class="code"><pre>0</pre></td> </tr> <tr> <td>FIXTURE_DIRS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>FORCE_SCRIPT_NAME</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FORMAT_MODULE_PATH</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FORM_RENDERER</td> <td class="code"><pre>'django.forms.renderers.DjangoTemplates'</pre></td> </tr> <tr> <td>IGNORABLE_404_URLS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>INSTALLED_APPS</td> <td class="code"><pre>['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'ukstagram']</pre></td> </tr> <tr> <td>INTERNAL_IPS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>LANGUAGES</td> <td class="code"><pre>[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ar-dz', 'Algerian Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('hy', 'Armenian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('ig', 'Igbo'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('ky', 'Kyrgyz'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('ms', 'Malay'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('tg', 'Tajik'), ('th', 'Thai'), ('tk', 'Turkmen'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('uz', 'Uzbek'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')]</pre></td> </tr> <tr> <td>LANGUAGES_BIDI</td> <td class="code"><pre>['he', 'ar', 'ar-dz', 'fa', 'ur']</pre></td> </tr> <tr> <td>LANGUAGE_CODE</td> <td class="code"><pre>'en-us'</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_AGE</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_DOMAIN</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_HTTPONLY</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_NAME</td> <td class="code"><pre>'django_language'</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_PATH</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_SAMESITE</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_SECURE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>LOCALE_PATHS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>LOGGING</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>LOGGING_CONFIG</td> <td class="code"><pre>'logging.config.dictConfig'</pre></td> </tr> <tr> <td>LOGIN_REDIRECT_URL</td> <td class="code"><pre>'/accounts/profile/'</pre></td> </tr> <tr> <td>LOGIN_URL</td> <td class="code"><pre>'/accounts/login/'</pre></td> </tr> <tr> <td>LOGOUT_REDIRECT_URL</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>MANAGERS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>MEDIA_ROOT</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>MEDIA_URL</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>MESSAGE_STORAGE</td> <td class="code"><pre>'django.contrib.messages.storage.fallback.FallbackStorage'</pre></td> </tr> <tr> <td>MIDDLEWARE</td> <td class="code"><pre>['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']</pre></td> </tr> <tr> <td>MIGRATION_MODULES</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>MONTH_DAY_FORMAT</td> <td class="code"><pre>'F j'</pre></td> </tr> <tr> <td>NUMBER_GROUPING</td> <td class="code"><pre>0</pre></td> </tr> <tr> <td>PASSWORD_HASHERS</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>PASSWORD_RESET_TIMEOUT</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>PREPEND_WWW</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>ROOT_URLCONF</td> <td class="code"><pre>'DRF.urls'</pre></td> </tr> <tr> <td>SECRET_KEY</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>SECURE_CONTENT_TYPE_NOSNIFF</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>SECURE_CROSS_ORIGIN_OPENER_POLICY</td> <td class="code"><pre>'same-origin'</pre></td> </tr> <tr> <td>SECURE_HSTS_INCLUDE_SUBDOMAINS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SECURE_HSTS_PRELOAD</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SECURE_HSTS_SECONDS</td> <td class="code"><pre>0</pre></td> </tr> <tr> <td>SECURE_PROXY_SSL_HEADER</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SECURE_REDIRECT_EXEMPT</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>SECURE_REFERRER_POLICY</td> <td class="code"><pre>'same-origin'</pre></td> </tr> <tr> <td>SECURE_SSL_HOST</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SECURE_SSL_REDIRECT</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SERVER_EMAIL</td> <td class="code"><pre>'root@localhost'</pre></td> </tr> <tr> <td>SESSION_CACHE_ALIAS</td> <td class="code"><pre>'default'</pre></td> </tr> <tr> <td>SESSION_COOKIE_AGE</td> <td class="code"><pre>1209600</pre></td> </tr> <tr> <td>SESSION_COOKIE_DOMAIN</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SESSION_COOKIE_HTTPONLY</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>SESSION_COOKIE_NAME</td> <td class="code"><pre>'sessionid'</pre></td> </tr> <tr> <td>SESSION_COOKIE_PATH</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>SESSION_COOKIE_SAMESITE</td> <td class="code"><pre>'Lax'</pre></td> </tr> <tr> <td>SESSION_COOKIE_SECURE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SESSION_ENGINE</td> <td class="code"><pre>'django.contrib.sessions.backends.db'</pre></td> </tr> <tr> <td>SESSION_EXPIRE_AT_BROWSER_CLOSE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SESSION_FILE_PATH</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SESSION_SAVE_EVERY_REQUEST</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SESSION_SERIALIZER</td> <td class="code"><pre>'django.contrib.sessions.serializers.JSONSerializer'</pre></td> </tr> <tr> <td>SETTINGS_MODULE</td> <td class="code"><pre>'DRF.settings'</pre></td> </tr> <tr> <td>SHORT_DATETIME_FORMAT</td> <td class="code"><pre>'m/d/Y P'</pre></td> </tr> <tr> <td>SHORT_DATE_FORMAT</td> <td class="code"><pre>'m/d/Y'</pre></td> </tr> <tr> <td>SIGNING_BACKEND</td> <td class="code"><pre>'django.core.signing.TimestampSigner'</pre></td> </tr> <tr> <td>SILENCED_SYSTEM_CHECKS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>STATICFILES_DIRS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>STATICFILES_FINDERS</td> <td class="code"><pre>['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']</pre></td> </tr> <tr> <td>STATICFILES_STORAGE</td> <td class="code"><pre>'django.contrib.staticfiles.storage.StaticFilesStorage'</pre></td> </tr> <tr> <td>STATIC_ROOT</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>STATIC_URL</td> <td class="code"><pre>'/static/'</pre></td> </tr> <tr> <td>TEMPLATES</td> <td class="code"><pre>[{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'OPTIONS': {'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages']}}]</pre></td> </tr> <tr> <td>TEST_NON_SERIALIZED_APPS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>TEST_RUNNER</td> <td class="code"><pre>'django.test.runner.DiscoverRunner'</pre></td> </tr> <tr> <td>THOUSAND_SEPARATOR</td> <td class="code"><pre>','</pre></td> </tr> <tr> <td>TIME_FORMAT</td> <td class="code"><pre>'P'</pre></td> </tr> <tr> <td>TIME_INPUT_FORMATS</td> <td class="code"><pre>['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']</pre></td> </tr> <tr> <td>TIME_ZONE</td> <td class="code"><pre>'Asia/Seoul'</pre></td> </tr> <tr> <td>USE_DEPRECATED_PYTZ</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>USE_I18N</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>USE_L10N</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>USE_THOUSAND_SEPARATOR</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>USE_TZ</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>USE_X_FORWARDED_HOST</td> <td class="code"><pre>False</pre></td> </tr> <div id="explanation"> <p> You’re seeing this error because you have <code>DEBUG = True</code> in your Django settings file. Change that to <code>False</code>, and Django will display a standard page generated by the handler for this status code. </p> </div> </body> </html>
답변 2
0
0
안녕하세요.
서버에서 요청 처리 중에 예기치못한 오류가 발생하면 오류 응답을 받게 됩니다. settings.DEBUG 를 끈다고 해서 오류가 사라지는 것은 아닙니다. 단지 오류응답이 자세하지않을 뿐입니다.
오류 메세지에 답이 있습니다. 절대 상상하지 마세요. 원인을 파악하는 연습이 필요합니다.
DEBUG 옵션을 켜주시구요. 오류가 발생하는 httpie 명령의 출력은, 서버에서 받은 그대로 html 포맷일 것입니다. 이를 파일로 저장하여 웹브라우저로 보시면 에러내용을 파악하시기 용이하실 것입니다.
http 수행하신 명령 > error.html
위와 같이 명령을 수행하시면 에러 내용이 지정 파일에 저장이 됩니다. 생성된 파일을 윈도우 탐색기에서 더블클릭하여 열어서 오류 내용을 확인해보세요.
화이팅입니다. :-)