我正在使用Django REST框架,所有的API调用都来自安卓和iOS应用程序。然而,当发生内部服务器错误时,当我从Django收到一封电子邮件时,系统大多数情况下运行良好,WSGIRequest的WSGIRequest的<could not parse>包含<could not parse>,而不是实际发布的JSON数据(尽管'CONTENT_TYPE': 'application/json'也在头中,数据以JSON的形式发送)。
这真的很烦人,因为如果看到实际导致错误的请求体,而不仅仅是堆栈跟踪,那就太好了。
<could n
当使用类继承时,Python3在super() argument 1 must be type, not WSGIRequest中失败了。
我在Django 2.1.4和Python3.7.0上。我试图看看用户是否已经提交了要分析的文件,如果没有,他将被定向到提交页面。我尝试不使用静态方法,检查它是否真的是Python3(因为这个问题在Python2上很常见),在我试图从"object“继承的超类上,同时也从Django提供的"View”继承(因为这在Python2中解决了)。
这是一个超类,它继承了Django "View“提供的类。
class DatasetReq
我正在努力让我的俱乐部网站恢复和运行后,我们以前的程序员离开。他没有留下任何东西,所以现在当我运行它时,Django会给我错误:
File "/home/serverad/django14_project/my_django15_project/tsa/events/views.py", line 112, in custom500 return render_template('errors/500.mako', request, parent='../base.mako' if request.user.is_authenticate
在使用Django和Python打开插入页时,我收到了一个错误。以下是错误:
TypeError at /insert/
context must be a dict rather than WSGIRequest.
Request Method: GET
Request URL: http://127.0.0.1:8000/insert/
Django Version: 1.11.2
Exception Type: TypeError
Exception Value:
context must be a dict rather than WSGIRequest.
Excepti
我正在制作一个钱包应用程序,所以如果有人去添加钱,然后按下submit,就必须将钱添加到他们的钱包中,但是在提交之后有一个错误:
AttributeError at /add_money/ 'unicode' object has no attribute 'user'
为了更好地了解行动流程,我设置了一些检查站:
Request <WSGIRequest: GET '/add_money/'>
Request j <WSGIRequest: GET '/add_money/'>
[15/Dec/2016
在Django中,我创建了一个函数装饰器,在本例中,它可以创建所提供的POST/GET参数的小写版本,并在视图处理所有请求之前更新请求。我为此创建了以下装饰器:
def force_lowercase(*fields):
assert isinstance(fields, tuple), "Fields must be of type tuple."
def wrap_func(fn):
def wrapper(request):
post = request.POST.copy()
get = re
我试图为django应用程序编写一些测试,结果出现了一个错误:
File "/Users/croberts/.virtualenvs/litem/lib/python3.4/site-packages/django/contrib/auth/__init__.py", line 101, in login
if SESSION_KEY in request.session:
AttributeError: 'WSGIRequest' object has no attribute 'session'
下面是我试图运行的代码:
class
django在哪里存储PUT和DELETE请求信息。这是POST还是什么的?
if not (request.POST.get(required_arg) or request.GET.get(required_arg) or request.DELETE.get(required_arg)):
'WSGIRequest' object has no attribute 'DELETE'
当我尝试使用request.Files时,我得到以下错误
WSGIRequest' object has no attribute 'Files'
这是我的views.py
from django.contrib import messages
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
fr
这是我在models.py的一堂课:
from django.db import models
from django.contrib.auth.models import User as defaultUser
class User(models.Model):
user = models.OneToOneField(defaultUser)
points = models.PositiveIntegerField(default=50)
这是我的views.py:
def home(request):
username = request.user.usernam
我有一个django视图函数signout,我想调用它形成一个表单/模板。当我单击注销时,它会调用函数,但之后的重定向不起作用。我收到消息Reverse for '<WSGIRequest: POST '/account/signout'>' not found. '<WSGIRequest: POST '/account/signout'>' is not a valid view function or pattern name.
Urls.py
urlpatterns = [
pat
我有一个页面,有3种类型的按钮(苹果,香蕉,橙色),点击第一个按钮,就会出现一个表格来获取信息。第一个按钮应该向苹果模型发送信息,香蕉按钮应该向香蕉模型发送信息,等等!
这是我的models.py:
from django.db import models
class Apple(models.Model):
first_name = models.CharField(max_length=100)
class Banana(models.Model):
first_name = models.CharField(max_length=100)
class Orange(
我有一个Django (1.5版)应用程序,它收到以下Oracle错误:
ORA-01461: can bind a LONG value only for insert into a LONG column
在进行了一些数据库调试之后,问题似乎是由于使用SESSION_DATA (数据类型NCLOB)的较长(大约2.5k个字符) Unicode字符串值在DJANGO_SESSION表上执行INSERT而导致的。
我的一位同事告诉我,这个问题不会发生在更新上,而只发生在插入上,因为更新的Django数据库代码包含将数据库写入拆分成可管理的块的逻辑(我在这里解释),但由于某种原因,插入缺少该逻辑
在我的站点的仪表板上呈现表单上的信息有问题,其中显示用户在注册时输入的信息。
我收到的错误消息是AttributeError at /dashboard/:'WSGIRequest‘对象没有属性'profileuser'
对我做错了什么有什么想法吗?
Models.py:
from django.db import models
from django.contrib.auth.models import User
class ProfileUser(models.Model):
user = models.OneToOneField(User)
b
我想测试我的graphql突变,它应该只设置一个HTTP cookie。
我使用石墨烯-django
class CookieTest(GraphQLTestCase):
def test_set_cookie(self):
response = self.query(...) # This should return WSGIRequest
cookie = response.COOKIES.get('myCookie') # This line throws an attrib error
self.assertIsNotNone(cookie)