request.POST empty after upgrading from Django 1.11 to Django 2.1
This post is a follow-up of this previous question:
Django request.POST empty
I had a project up and running with Python 3.5.4 and Django 1.11.13, on Visual Studio 2015. I later updated to Django 2.1.2 because I wanted to import the "path" module, so that I can use this:
urlpatterns = [
path ( '', c_views.Indice, name = 'indice' ),
path ( '<int:CompiladoID>', c_views.Detalle, name = 'detalle'),
path ( 'elementos/<int:CompiladoID>', c_views.Elementos, name = 'elementos'),
path ( 'datoselementos/<int:ElementoID>', c_views.DatosElemento, name = 'datoselemento'),
...instead of this:
urlpatterns = [
url ( r'^$', c_views.Indice, name = 'indice'),
url ( r'^(?P<CompiladoID>d+)/$', c_views.Detalle, name = 'detalle' ),
url ( r'^(?P<CompiladoID>d+)/elementos$', c_views.Elementos, name = 'elementos' ),
url ( r'^(?P<CompiladoID>d+)/generar$', c_views.Generar, name = 'generar' ),
which I find easier to declare and read. After this change I started to experience problems with request.POST. I got a "request" response, but POST was empty, as shown here:
Actually, I was not initially aware of this. It's taken me 3 days, and a compare with a backup copy that I've recovered, to realize that Django version was different. That said, I'm puzzled about the fact that a newer version of Django should not be able to do something that older versions did, unless something has changed that I don't know of. I've only been working with Python/Django for a couple of months, can anyone tell me if there is a reason to this? Can I not use path
instead of url
for my urlpatterns
using Django 2.1.2?
Thank you in advance for your help.
EDIT (november 14th)
This is my settings.py
(I basically added 'app'
to INSTALLED_APPS
):
"""
Django settings for MemoProject project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
import posixpath
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '---'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS =
# Application definition
INSTALLED_APPS = [
'app',
# Add your apps here to enable them
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'MemoProject.urls'
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ,
'APP_DIRS': True,
'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',
],
,
,
]
WSGI_APPLICATION = 'MemoProject.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES =
'default':
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
,
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
,
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
,
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
,
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
python django post url-pattern
add a comment |
This post is a follow-up of this previous question:
Django request.POST empty
I had a project up and running with Python 3.5.4 and Django 1.11.13, on Visual Studio 2015. I later updated to Django 2.1.2 because I wanted to import the "path" module, so that I can use this:
urlpatterns = [
path ( '', c_views.Indice, name = 'indice' ),
path ( '<int:CompiladoID>', c_views.Detalle, name = 'detalle'),
path ( 'elementos/<int:CompiladoID>', c_views.Elementos, name = 'elementos'),
path ( 'datoselementos/<int:ElementoID>', c_views.DatosElemento, name = 'datoselemento'),
...instead of this:
urlpatterns = [
url ( r'^$', c_views.Indice, name = 'indice'),
url ( r'^(?P<CompiladoID>d+)/$', c_views.Detalle, name = 'detalle' ),
url ( r'^(?P<CompiladoID>d+)/elementos$', c_views.Elementos, name = 'elementos' ),
url ( r'^(?P<CompiladoID>d+)/generar$', c_views.Generar, name = 'generar' ),
which I find easier to declare and read. After this change I started to experience problems with request.POST. I got a "request" response, but POST was empty, as shown here:
Actually, I was not initially aware of this. It's taken me 3 days, and a compare with a backup copy that I've recovered, to realize that Django version was different. That said, I'm puzzled about the fact that a newer version of Django should not be able to do something that older versions did, unless something has changed that I don't know of. I've only been working with Python/Django for a couple of months, can anyone tell me if there is a reason to this? Can I not use path
instead of url
for my urlpatterns
using Django 2.1.2?
Thank you in advance for your help.
EDIT (november 14th)
This is my settings.py
(I basically added 'app'
to INSTALLED_APPS
):
"""
Django settings for MemoProject project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
import posixpath
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '---'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS =
# Application definition
INSTALLED_APPS = [
'app',
# Add your apps here to enable them
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'MemoProject.urls'
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ,
'APP_DIRS': True,
'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',
],
,
,
]
WSGI_APPLICATION = 'MemoProject.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES =
'default':
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
,
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
,
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
,
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
,
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
python django post url-pattern
1
I'm not sure why you think this has anything to do with path vs url. And of course Django 2.1 definitely can receive POST parameters, it wouldn't be much use as a web framework if it couldn't. Therefore the problem is definitely somewhere else. One possible culprit is middleware; can you post your middleware settings?
– Daniel Roseman
Nov 13 at 16:57
what's the content ofrequest.data
?
– rikAtee
Nov 13 at 17:02
Thanks for the quick reply. You're right, I don't think it has anything to do withurl
vspath
. It's just thatpath
didn't work with Django 1.11, so I updated to Django 2.1 in order to use it. But, apparently, as a side effect,request.POST
started to show up empty. But I agree with you, the problem must be somewhere else, this doesn't seem right. I'm new to this, so I'm probably screwing up some configuration option. I'll edit the original post to add mysettings.py
, please look it up there. As for myrequest.data
, I have no such element (please see the image above).
– VMF
Nov 14 at 8:47
add a comment |
This post is a follow-up of this previous question:
Django request.POST empty
I had a project up and running with Python 3.5.4 and Django 1.11.13, on Visual Studio 2015. I later updated to Django 2.1.2 because I wanted to import the "path" module, so that I can use this:
urlpatterns = [
path ( '', c_views.Indice, name = 'indice' ),
path ( '<int:CompiladoID>', c_views.Detalle, name = 'detalle'),
path ( 'elementos/<int:CompiladoID>', c_views.Elementos, name = 'elementos'),
path ( 'datoselementos/<int:ElementoID>', c_views.DatosElemento, name = 'datoselemento'),
...instead of this:
urlpatterns = [
url ( r'^$', c_views.Indice, name = 'indice'),
url ( r'^(?P<CompiladoID>d+)/$', c_views.Detalle, name = 'detalle' ),
url ( r'^(?P<CompiladoID>d+)/elementos$', c_views.Elementos, name = 'elementos' ),
url ( r'^(?P<CompiladoID>d+)/generar$', c_views.Generar, name = 'generar' ),
which I find easier to declare and read. After this change I started to experience problems with request.POST. I got a "request" response, but POST was empty, as shown here:
Actually, I was not initially aware of this. It's taken me 3 days, and a compare with a backup copy that I've recovered, to realize that Django version was different. That said, I'm puzzled about the fact that a newer version of Django should not be able to do something that older versions did, unless something has changed that I don't know of. I've only been working with Python/Django for a couple of months, can anyone tell me if there is a reason to this? Can I not use path
instead of url
for my urlpatterns
using Django 2.1.2?
Thank you in advance for your help.
EDIT (november 14th)
This is my settings.py
(I basically added 'app'
to INSTALLED_APPS
):
"""
Django settings for MemoProject project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
import posixpath
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '---'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS =
# Application definition
INSTALLED_APPS = [
'app',
# Add your apps here to enable them
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'MemoProject.urls'
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ,
'APP_DIRS': True,
'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',
],
,
,
]
WSGI_APPLICATION = 'MemoProject.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES =
'default':
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
,
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
,
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
,
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
,
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
python django post url-pattern
This post is a follow-up of this previous question:
Django request.POST empty
I had a project up and running with Python 3.5.4 and Django 1.11.13, on Visual Studio 2015. I later updated to Django 2.1.2 because I wanted to import the "path" module, so that I can use this:
urlpatterns = [
path ( '', c_views.Indice, name = 'indice' ),
path ( '<int:CompiladoID>', c_views.Detalle, name = 'detalle'),
path ( 'elementos/<int:CompiladoID>', c_views.Elementos, name = 'elementos'),
path ( 'datoselementos/<int:ElementoID>', c_views.DatosElemento, name = 'datoselemento'),
...instead of this:
urlpatterns = [
url ( r'^$', c_views.Indice, name = 'indice'),
url ( r'^(?P<CompiladoID>d+)/$', c_views.Detalle, name = 'detalle' ),
url ( r'^(?P<CompiladoID>d+)/elementos$', c_views.Elementos, name = 'elementos' ),
url ( r'^(?P<CompiladoID>d+)/generar$', c_views.Generar, name = 'generar' ),
which I find easier to declare and read. After this change I started to experience problems with request.POST. I got a "request" response, but POST was empty, as shown here:
Actually, I was not initially aware of this. It's taken me 3 days, and a compare with a backup copy that I've recovered, to realize that Django version was different. That said, I'm puzzled about the fact that a newer version of Django should not be able to do something that older versions did, unless something has changed that I don't know of. I've only been working with Python/Django for a couple of months, can anyone tell me if there is a reason to this? Can I not use path
instead of url
for my urlpatterns
using Django 2.1.2?
Thank you in advance for your help.
EDIT (november 14th)
This is my settings.py
(I basically added 'app'
to INSTALLED_APPS
):
"""
Django settings for MemoProject project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
import posixpath
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '---'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS =
# Application definition
INSTALLED_APPS = [
'app',
# Add your apps here to enable them
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'MemoProject.urls'
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ,
'APP_DIRS': True,
'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',
],
,
,
]
WSGI_APPLICATION = 'MemoProject.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES =
'default':
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
,
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
,
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
,
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
,
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
python django post url-pattern
python django post url-pattern
edited Nov 16 at 14:55
Alasdair
178k26301306
178k26301306
asked Nov 13 at 16:46
VMF
133
133
1
I'm not sure why you think this has anything to do with path vs url. And of course Django 2.1 definitely can receive POST parameters, it wouldn't be much use as a web framework if it couldn't. Therefore the problem is definitely somewhere else. One possible culprit is middleware; can you post your middleware settings?
– Daniel Roseman
Nov 13 at 16:57
what's the content ofrequest.data
?
– rikAtee
Nov 13 at 17:02
Thanks for the quick reply. You're right, I don't think it has anything to do withurl
vspath
. It's just thatpath
didn't work with Django 1.11, so I updated to Django 2.1 in order to use it. But, apparently, as a side effect,request.POST
started to show up empty. But I agree with you, the problem must be somewhere else, this doesn't seem right. I'm new to this, so I'm probably screwing up some configuration option. I'll edit the original post to add mysettings.py
, please look it up there. As for myrequest.data
, I have no such element (please see the image above).
– VMF
Nov 14 at 8:47
add a comment |
1
I'm not sure why you think this has anything to do with path vs url. And of course Django 2.1 definitely can receive POST parameters, it wouldn't be much use as a web framework if it couldn't. Therefore the problem is definitely somewhere else. One possible culprit is middleware; can you post your middleware settings?
– Daniel Roseman
Nov 13 at 16:57
what's the content ofrequest.data
?
– rikAtee
Nov 13 at 17:02
Thanks for the quick reply. You're right, I don't think it has anything to do withurl
vspath
. It's just thatpath
didn't work with Django 1.11, so I updated to Django 2.1 in order to use it. But, apparently, as a side effect,request.POST
started to show up empty. But I agree with you, the problem must be somewhere else, this doesn't seem right. I'm new to this, so I'm probably screwing up some configuration option. I'll edit the original post to add mysettings.py
, please look it up there. As for myrequest.data
, I have no such element (please see the image above).
– VMF
Nov 14 at 8:47
1
1
I'm not sure why you think this has anything to do with path vs url. And of course Django 2.1 definitely can receive POST parameters, it wouldn't be much use as a web framework if it couldn't. Therefore the problem is definitely somewhere else. One possible culprit is middleware; can you post your middleware settings?
– Daniel Roseman
Nov 13 at 16:57
I'm not sure why you think this has anything to do with path vs url. And of course Django 2.1 definitely can receive POST parameters, it wouldn't be much use as a web framework if it couldn't. Therefore the problem is definitely somewhere else. One possible culprit is middleware; can you post your middleware settings?
– Daniel Roseman
Nov 13 at 16:57
what's the content of
request.data
?– rikAtee
Nov 13 at 17:02
what's the content of
request.data
?– rikAtee
Nov 13 at 17:02
Thanks for the quick reply. You're right, I don't think it has anything to do with
url
vs path
. It's just that path
didn't work with Django 1.11, so I updated to Django 2.1 in order to use it. But, apparently, as a side effect, request.POST
started to show up empty. But I agree with you, the problem must be somewhere else, this doesn't seem right. I'm new to this, so I'm probably screwing up some configuration option. I'll edit the original post to add my settings.py
, please look it up there. As for my request.data
, I have no such element (please see the image above).– VMF
Nov 14 at 8:47
Thanks for the quick reply. You're right, I don't think it has anything to do with
url
vs path
. It's just that path
didn't work with Django 1.11, so I updated to Django 2.1 in order to use it. But, apparently, as a side effect, request.POST
started to show up empty. But I agree with you, the problem must be somewhere else, this doesn't seem right. I'm new to this, so I'm probably screwing up some configuration option. I'll edit the original post to add my settings.py
, please look it up there. As for my request.data
, I have no such element (please see the image above).– VMF
Nov 14 at 8:47
add a comment |
1 Answer
1
active
oldest
votes
MIDDLEWARE_CLASSES
was deprecated in Django 1.10 and removed in Django 2.0. You should be using MIDDLEWARE
instead.
You should remove SessionAuthenticationMiddleware
because it hasn't been required since Django 1.10.
Django 1.11 gives a deprecation warning that you should switch from MIDDLEWARE
, but you must have missed this. Before upgrading Django, it's good practice to read the release notes, and fix any deprecation warnings. See the upgrade guide for more info.
Bingo!!! That did it, thanks so much :)
– VMF
Nov 14 at 11:51
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285783%2frequest-post-empty-after-upgrading-from-django-1-11-to-django-2-1%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
MIDDLEWARE_CLASSES
was deprecated in Django 1.10 and removed in Django 2.0. You should be using MIDDLEWARE
instead.
You should remove SessionAuthenticationMiddleware
because it hasn't been required since Django 1.10.
Django 1.11 gives a deprecation warning that you should switch from MIDDLEWARE
, but you must have missed this. Before upgrading Django, it's good practice to read the release notes, and fix any deprecation warnings. See the upgrade guide for more info.
Bingo!!! That did it, thanks so much :)
– VMF
Nov 14 at 11:51
add a comment |
MIDDLEWARE_CLASSES
was deprecated in Django 1.10 and removed in Django 2.0. You should be using MIDDLEWARE
instead.
You should remove SessionAuthenticationMiddleware
because it hasn't been required since Django 1.10.
Django 1.11 gives a deprecation warning that you should switch from MIDDLEWARE
, but you must have missed this. Before upgrading Django, it's good practice to read the release notes, and fix any deprecation warnings. See the upgrade guide for more info.
Bingo!!! That did it, thanks so much :)
– VMF
Nov 14 at 11:51
add a comment |
MIDDLEWARE_CLASSES
was deprecated in Django 1.10 and removed in Django 2.0. You should be using MIDDLEWARE
instead.
You should remove SessionAuthenticationMiddleware
because it hasn't been required since Django 1.10.
Django 1.11 gives a deprecation warning that you should switch from MIDDLEWARE
, but you must have missed this. Before upgrading Django, it's good practice to read the release notes, and fix any deprecation warnings. See the upgrade guide for more info.
MIDDLEWARE_CLASSES
was deprecated in Django 1.10 and removed in Django 2.0. You should be using MIDDLEWARE
instead.
You should remove SessionAuthenticationMiddleware
because it hasn't been required since Django 1.10.
Django 1.11 gives a deprecation warning that you should switch from MIDDLEWARE
, but you must have missed this. Before upgrading Django, it's good practice to read the release notes, and fix any deprecation warnings. See the upgrade guide for more info.
edited Nov 14 at 13:08
answered Nov 14 at 10:17
Alasdair
178k26301306
178k26301306
Bingo!!! That did it, thanks so much :)
– VMF
Nov 14 at 11:51
add a comment |
Bingo!!! That did it, thanks so much :)
– VMF
Nov 14 at 11:51
Bingo!!! That did it, thanks so much :)
– VMF
Nov 14 at 11:51
Bingo!!! That did it, thanks so much :)
– VMF
Nov 14 at 11:51
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285783%2frequest-post-empty-after-upgrading-from-django-1-11-to-django-2-1%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I'm not sure why you think this has anything to do with path vs url. And of course Django 2.1 definitely can receive POST parameters, it wouldn't be much use as a web framework if it couldn't. Therefore the problem is definitely somewhere else. One possible culprit is middleware; can you post your middleware settings?
– Daniel Roseman
Nov 13 at 16:57
what's the content of
request.data
?– rikAtee
Nov 13 at 17:02
Thanks for the quick reply. You're right, I don't think it has anything to do with
url
vspath
. It's just thatpath
didn't work with Django 1.11, so I updated to Django 2.1 in order to use it. But, apparently, as a side effect,request.POST
started to show up empty. But I agree with you, the problem must be somewhere else, this doesn't seem right. I'm new to this, so I'm probably screwing up some configuration option. I'll edit the original post to add mysettings.py
, please look it up there. As for myrequest.data
, I have no such element (please see the image above).– VMF
Nov 14 at 8:47