75
You’re not doing anything wrong; this is a problem between Django and Python 3.7. Django has a fix, but that fix hasn’t made it into a new version yet.
You can install the stable version of Python, Python 3.6, in the meantime.
16
This is a known incompatibility between Django and Python 3.7. A fix has already been merged into Django 2.x branches and backported into 1.11 branch.
To solve this issue, simply update Django to at least version 1.11.17 (or 2.x) or you can downgrade Python to version 3.6.
- [Django]-Tailwindcss: fixed/sticky footer on the bottom
- [Django]-Collectstatic error while deploying Django app to Heroku
- [Django]-Django's SuspiciousOperation Invalid HTTP_HOST header
13
- [Django]-What is the easiest way to clear a database from the CLI with manage.py in Django?
- [Django]-How do I clone a Django model instance object and save it to the database?
- [Django]-How to change the name of a Django app?
3
Only Django==2.2 will be supported to Python 3.7 so upgrading your Django Version will solve your problem
pip3 install django --upgrade
- [Django]-Django: how can I tell if the post_save signal triggers on a new object?
- [Django]-Django MEDIA_URL and MEDIA_ROOT
- [Django]-Django, creating a custom 500/404 error page
2
The Django Girls tutorial version in English has just switched to Django 2.0 which should make it compatible to Python 3.7. (Django 2.0 includes a backport of the fix mentioned in Ry-‘s answer.)
So everyone beginning the tutorial now should be fine with Python 3.7.
If you’ve already begun the tutorial you’d have to start again at the Django installation chapter. You’ll want to do that in a new directory (either delete or rename your current djangogirls
directory or choose a different name for the new directory) as the files generated by
django-admin print startproject mysite .
depend on the Django version in use.
- [Django]-How to automatically login a user after registration in django
- [Django]-How to change a django QueryDict to Python Dict?
- [Django]-Django-Bower + Foundation 5 + SASS, How to configure?
1
Per Django’s FAQ, Django 1.11.x is not compatible with Python 3.7.
Django 1.11.x reached end of mainstream support on December 2, 2017 and it receives only data loss and security fixes until its end of life.
- [Django]-Startapp with manage.py to create app in another directory
- [Django]-Why does django's prefetch_related() only work with all() and not filter()?
- [Django]-Parsing a Datetime String into a Django DateTimeField
0
As all of the above answers already suggesting that there’s a miss match between Django and Python version.
While creating a virtual environment, please run the following command
python3.6 -m venv myenv
It will use Python3.6 while creating your virtual environment.
Now you can install all the dependencies in this virtual environment.
- [Django]-What does this "-" in jinja2 template engine do?
- [Django]-Passing Python Data to JavaScript via Django
- [Django]-Django Rest Framework: Dynamically return subset of fields
0
I got this issue solved by upgrading Django to Dajngo==1.11.29, the last release of Dajngo 1.11. I think my python version was 3.8.x. Give it a try if you are not planning to upgrade to Django 2.x or 3.x
- [Django]-Django set field value after a form is initialized
- [Django]-How to create a user in Django?
- [Django]-VueJS + Django Channels
-1
Follow the below-mentioned steps to fix the issue:
- Move to the directory where you have installed the
virtualenv
- You will find a directory named lib. Inside that directory, you will find a directory named pythonx.y where x.y is the version of python you are using
- Now, go to
site-packages
- Then go to the directory
django
- Move to
contrib
directory - Now, go to
admin
directory. This is where you would find a python filewidgets.py
- Find the following code snippet in that file
if params:
related_url += '?' + '&'.join(
related_url += '?' + '&'.join('%s=%s' % (k, v) for k, v in params.items())
'%s=%s' % (k, v) for k, v in params.items(),
)
You need to change that to the following
if params:
related_url += '?' + '&'.join(
related_url += '?' + '&'.join('%s=%s' % (k, v) for k, v in params.items())
Save the changes and execute the migrate again.
- [Django]-PicklingError: Can't pickle <class 'decimal.Decimal'>: it's not the same object as decimal.Decimal
- [Django]-How to spread django unit tests over multiple files?
- [Django]-How do you change the collation type for a MySQL column?