Questions tagged [django-2.0]

Django 2.0 is a version of the Django framework, released December 2017. Please only use this tag if your question relates specifically to this version.

Django 2.0 requires Python 3.4, 3.5, or 3.6. It is the first version of Django to support only Python 3.

Here are some of the salient features of Django 2.0:

Django 2.0 was released in December 2017 and was supported until April 2019.

423 questions
4
votes
2 answers

What is the use of wsgi.py file that is there in django application when created using django-admin startproject

Can anyone help me in understanding what is the use of wsgi.py file? import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings.local") application = get_wsgi_application()
troy
  • 75
  • 1
  • 1
  • 5
4
votes
2 answers

Return proxied class in many to many relation, Django 2.0

From another installed app, I have models like this class Organization(model.Model): name = models.CharField(max_length=255, blank=True) class Person(model.Model): name = models.CharField(max_length=255, blank=True) class…
fgregg
  • 3,173
  • 30
  • 37
4
votes
1 answer

How to pass more than two parameters in a queryset in Django?

I hope my question is understood For example, I have this model class Area(models.Model): area_id = models.IntegerField() name = models.CharField() last_name = models.CharField() short_name = models.CharField() I want to make a query with…
Alex
  • 615
  • 8
  • 26
4
votes
1 answer

Django: unhashable type:'list' error

I am working on Django 2 projects. I have an error that I have not encountered before. HTML Page:

Postlar burada görüntüleniyor

Post Oluştur {% for post in listelenen_postlar %}
mete eroğlu
  • 95
  • 2
  • 10
4
votes
2 answers

How do I make this regex URL pattern work in Django 2

I need to make a URL pattern which could work with this URL: mysite.com/blog/12/بلاگ-مثال It contains utf-8 characters so I tried using \X: re_path(r'^blog/?P[\d+]+/(?P[\X.*]+)/$', views.single_blog, name='single_blog') But it…
Ghasem
  • 14,455
  • 21
  • 138
  • 171
4
votes
2 answers

Mock() function gives TypeError in django2

I'm following this tutorial. When I run test_views.py I have an error that shouldn't be there according the author: TypeError: quote_from_bytes() expected bytes. My views and my test_views are the same like the book, but I'm using django 2.0.6…
fabio
  • 1,210
  • 2
  • 26
  • 55
4
votes
2 answers

Django URLResolver error

I am trying to host a Django app on windows server using IIS using wfastcgi. After creating a new django project using django-admin.py startproject foo,the admin page opens up fine when I run it with the django server python manage.py…
user72070
  • 55
  • 1
  • 6
4
votes
0 answers

File upload security in Django-2.x

The documentation on secure file upload (https://docs.djangoproject.com/en/2.0/ref/models/fields/#file-upload-security) doesn't quite answer my concerns. Consider the following use case : a (potentially malicious) user can use a form to upload a…
shrimpdrake
  • 1,476
  • 2
  • 14
  • 25
4
votes
1 answer

Django: Superuser and user cannot login to admin and user page after making an email login field instead of username

I was looking for the the answer and I still can't find the solution, which works for me. I am new to Django. I write a web app, which will be basically a blog in which authors are going to have their sites and under each article there will be a…
4
votes
2 answers

Python Django 2.0 DecimalField "Ensure that there are no more than 3 digits before the decimal point"

My amount column attributes are set to max_digits = 13, decimal_places = 7 because you could technically have something like 10000.0000001 bitcoin. When I try to enter and submit just 0.1 Bitcoin on my form I get the error: Ensure that there are…
SkillSet12345
  • 881
  • 3
  • 14
  • 25
4
votes
0 answers

Django request.POST.getlist() returns empty

I am trying to extract a posted array in Django 2. I am posting the following: sprints[0][id]: 5 sprints[0][name]: Test sprint 1 sprints[0][order]: 0 sprints[0][project]: sprints[0][start]: sprints[0][end]: sprints[1][id]: 6 sprints[1][name]:…
ggdx
  • 3,024
  • 4
  • 32
  • 48
4
votes
3 answers

Django SECRET KEY error

I'm building a little Django REST API. I've configured a separate settings module for local and production but I'm having an annoying error which is: django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty. This…
4
votes
1 answer

Django 2.0 haystack whoosh update index, rebuild index throw error

I am using django 2.0 with haystack+whoosh as a search. I configured as it is said in the documentation. Occurred problem is when i run ./manage.py rebuild_index it shows this error: Traceback (most recent call last): File "./manage.py", line 15,…
Zorig
  • 585
  • 1
  • 10
  • 26
4
votes
2 answers

DJango + nginx + gunicorn: how to stop caching

I am running Django 2.0 using gunicorn on nginx server. All my pages are not reflecting the changes immediately. How to stop caching the below are my files: nginx.conf server { listen 80; server_name sample.com; location = /favicon.ico…
Santhosh
  • 9,965
  • 20
  • 103
  • 243
4
votes
2 answers

how to have options in urls in django 2.0

In Django 1 I used to have url choices like this: url('meeting/(?Pedit|delete)/', views.meeting_view, name='meeting'), How I do this in Django 2.0 with the <> syntax: Maybe something like this? path('meeting/()/',…
Atma
  • 29,141
  • 56
  • 198
  • 299
1 2
3
28 29