App name error in Django

Asked

Viewed 42 times

0

In my views, Django 1.10, I have the code:

from django.shortcuts import *
from appcrud.forms import *

def inicial(request):
	if request.method == "POST":
		form = FormCrud(request.POST)
		if form.is_valid():
			form.save()
	else:
		form = FormCrud()
	return render(request, "index.html", {"form": form})

The Forms:

from django import forms
from appcrud.models import *

class FormCrud(forms.Form):
	name = forms.CharField(max_length = 150)
	profissao = forms.CharField(max_length=150)

and the model:

from __future__ import unicode_literals

from django.db import models
from mongoengine import *

class Cruds(Document):
	name = StringField(max_length=150,required=True)
	profissao = StringField(max_length=150)

The server works normally but this error appears in the return :

__init__() got an unexpected keyword argument 'current_app'
Request Method:	GET
Request URL:	http://localhost:8000/inicio/
Django Version:	1.10.3
Exception Type:	TypeError
Exception Value:	
__init__() got an unexpected keyword argument 'current_app'
Exception Location:	C:\Anaconda2\lib\site-packages\django\shortcuts\__init__.py in render, line 49

I am configuring the project to use mongodb, they would know me answer?

Grateful for the attention!

  • 1

    It seems that Django 1.10 is not installed correctly, because the render does not even have this argument anymore current_app in that version. My suggestion is to uninstall Django, and install again: pip uninstall -y Django pip install Django --no-cache-dir

  • Thanks, I did it and it worked!

  • I will play the text of the comment as an answer, to be documented to the guys who in the future bump into the same problem :)

1 answer

1


It seems that Django 1.10 is not installed correctly, because render does not even have this argument current_app in this version anymore. Uninstall Django, and install again, but without using the cache, with the following commands:

$ pip uninstall -y Django

$ pip install Django --no-cache-dir

Browser other questions tagged

You are not signed in. Login or sign up in order to post.