The intuitive mistake in this problem is that the access is different. The first reaction is related to the firewall, but after thinking that I am visiting a local project, it has nothing to do with the firewall. Later, I thought it might be the wrong address. The IP number is 127.0.0.1, so it must be the wrong port. Sure enough, the front end was accessing port 8000, but the server was listening on port 9999. Just make it consistent.
Tag Archives: django
Failed building wheel for psycopg2
My mistake:
Command "/ Users/qinlan/myproject/lenv1/bin/python3.6 - u - c" import setuptools, tokenize; __file__='/private/var/folders/l1/y1ch9__s6xx00p046b096_6m0000gn/T/pip-install-_p50tkoi/psycopg2/setup.py'; f=getattr(tokenize, 'open', open)(__file__); code=f.read().replace('\r\n', '\n'); f.close(); exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/l1/y1ch9__s6xx00p046b096_6m0000gn/T/pip-record-jml81n0v/install-record.txt --single-version-externally-managed --compile --install-headers /Users/qinlan/myproject/lenv1/bin/../include/site/python3.6 psycopg2 "failed with the error code 1 in/private/var/folders/l1/y1ch9__s6xx00p046b096_6m0000gn/T/PIP - install - _p50tkoi/psycopg2/ code>
Fix:
I fixed this problem by installing the command line tool
xcode-select --install
then install openssl through Homebrew and manually link the openssl installed by my homemade software to PIP:
env LDFLAGS = "-i/usr/local/opt/openssl/include - L/usr/local/opt/openssl/lib" PIP install psycopg2 code>
in the macOS Sierra 10.12.1
It is recommended that PIP Install PsycopG2-Binary instead
django.db.utils.IntegrityError: UNIQUE constraint failed: auth_user.username
Create user code has been completed, the user = user. The objects. The create_user (username = ‘356’ and password = ‘123456’), but an error in the back, then the created user has exists in the database mark>, when you change an error that part of the code to execute, complains, remind you that this user has been created in the database, so you can’t use the data to create.
where does the code execute to form something in the database
username must be unique
Forbidden (403) CSRF verification failed. Request aborted. – Django
How to solve the cross-domain problem of Django?
please see this article, very detailed: https://pypi.org/project/django-cors-headers/
The above is due to the CSRF problem, how to solve?
Two ways:
Top: comment out CsrfViewMiddleware
as shown, but
is not recommended
Second: add the annotation @csrf_exempt
to the interface view
The above two methods do solve 403 errors.
However, according to a lot of information, the approach is that the front end first USES get request to specify the interface, and then the server generates get_token(request)
to return to the front end. The front end carries csrftoken
returned when requesting the interface, which will verify whether the cookie is consistent…
But they all tried in vain…
We can see the article: https://www.cnblogs.com/rgcLOVEyaya/p/RGC_LOVE_YAYA_692days_802_1.html
CSRF verification failed. Request aborted.
Forbidden (403)
CSRF验证失败。请求中止。 p>
引用>Help Reason given for failure: CSRF token missing or incorrect. In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django's CSRF mechanism has not been used correctly. For POST forms, you need to ensure: Your browser is accepting cookies. The view function passes a request to the template's render method. In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. The form has a valid CSRF token. After logging in in another browser tab or hitting the back button after a login, you may need to reload the page with the form, because the token is rotated after a login. You're seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed. You can customize this page using the CSRF_FAILURE_VIEW setting.
** cross-site Request Forgery (CSRF) vulnerability. ** is a malicious exploit of a website. Although it sounds like cross-site scripting (XSS), it is very different from XSS, which exploits a trusted user within a site, while CSRF exploits a trusted site by impersonating a Request from a trusted user. CSRF attacks tend to be less prevalent (and therefore have relatively few resources to defend against) and harder to defend against than XSS attacks, and are therefore considered more dangerous than XSS attacks
can understand strong> :
the attacker steal your identity, in the name of your sending malicious request, the request for server is perfectly legal, but finished the attacker’s expectation of an operation, such as in the name of your email, send messages, to steal your account, add a system administrator, or even to buy goods, virtual currency transfer, etc.Django’s protection against CSRF is to place an auto-generated token in each generated form to determine whether a POST request is coming from the same site
solution one:
Use the Django template here. Use the TemplateTag to add CSRF tokens. Add {% crrf_token %}
in the from form
# index.html ... <form method="post"> <div > <input name="username" placeholder="username"><br> <input name="password" placeholder="password"><br> <div > <button type='submit' id='btn'>提交</button> </div> </div> {% csrf_token %} </form> ...
again, refresh the page and resubmit the form to access
normally
solution two:
simply ignores this check and comments CSRF in the Settings. Py of the project
MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', #'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ]
CSRF (cross-site request forgery)
CSRF specific see: p>
https://www.cnblogs.com/liuqingzheng/p/9505044.html
IntegrityError at ** NOT NULL constraint failed: learning_logs_topic.owner_id
in chapter 19 of python from introduction to practice, models add the user attribute of topic in learning_logs, that is, the topic created by the logged user, then the owner attribute of this topic is the logged user, code: Owner = model.foreignkey (User,on_delete= model.cascade), owner is the ForeignKey of User (pthon version 3.7.4, django version 2.2.6) and is coming up after makations:
, then select the option of ‘1)’, then select the user ID of 1, namely ll_admin, then the attribution user ID of the original topic is 1, namely ll_admin. The following error occurs when executing new_topic:
IntegrityError at /new_topic/ NOT NULL constraint failed: learning_logs_top.owner_id, error site as follows:
, of which topic model source code is as follows:
class Topic(models.model) :
text= model.charfield (max_length=200)
date_added= model.datetimefield (auto_now_add=True)
owner= model.foreignkey (User,on_delete= model.cascade)
def the __str__ (self) :
return self. The text p>
topicform source as follows:
class TopicForm (forms. ModelForm) :
class Meta:
model = Topic
fields = [‘ text ‘]
labels = {‘ text: “‘} p>
: new_topic under the learning_logs folder views. Py source code is as follows:
def new_topic(request) :
if request. Method! : = ‘POST’
form = TopicForm ()
the else:
form = TopicForm (request. POST).
if the form is_valid () :
form. The save ()
the return HttpResponseRedirect(‘learning_logs:topics’)
context={‘form’:form}
return render(request,’learning_logs/ new_top.html ‘,context)
this error shows null value limitation error: owner, owner is the attribute just added in models. Although the owner attribute is added in the existing topic, the newly added topic does not have an owner attribute, so an error is reported.
is solved as follows:
(1) add null=True to the models.py attribute, allowing this attribute to be empty
becomes owner= model.foreignkey after modification (User,on_delete= model.cascade, null=True). After modification, the error does not occur, but the owner of the newly added topic is null, and
is not intended by design
(2) adds the default value inside models.py.
modified owner= model.foreignkey (User,on_delete= model.cascade, default=1), and the modified error will not occur, but the owner of newly added topic is always the User with ID 1, and it is not the desired
(3) modify TopicForm and add owner field
modified TopicForm into the following:
class TopicForm (forms. ModelForm) :
class Meta:
model = Topic
fields = [‘ text, ‘the owner’]
labels = {‘ text ‘:’, ‘owner’ : ‘} p>
After
is modified, the user will select the owner of the new topic, as shown below:
although the current logged in user can choose the owner of this topic, the user can also choose other non-logged in users, which increases the risk of error
(4) in the views. Py new_topic view, get the current user with request.user and assign a value to form
is to add a line after if form.is_valid() :
form.instance.owner=request.user,
def new_topic(request) :
if request. Method! : = ‘POST’
form = TopicForm ()
the else:
form = TopicForm (request. POST).
if the form is_valid () :
form. The instance. The owner = request. User
Form. The save ()
return HttpResponseRedirect (reverse (‘ learning_logs: switchable viewer ‘))
the context = {‘ form: form}
the return render(request,’learning_logs/new_topic.html’,context)
USES the instance parameter of the Form to get the owner attribute and assigns the current user obtained by requset.user to the owner of the instance. After the modification, the program realizes the predetermined function
(5) also takes advantage of the instance parameter, but at the time of the generated Form, the modified new_topic view is as follows:
def new_topic(request) :
if request. Method! : = ‘POST’
form = TopicForm ()
the else:
form = TopicForm (request. POST)
topic = topic ()
topic. The owner = request. User
form = TopicForm (request. POST, the instance = topic).
if the form is_valid () :
form. The save ()
return HttpResponseRedirect (reverse (‘ learning_logs: switchable viewer ‘))
The context = {‘ form: form}
return render (request, ‘learning_logs/new_topic. HTML, context) p>
becomes a topic, then assign the value to the owner, and then assign the topic to the instance parameter, which costs a lot of space and time, but also achieves the predetermined function.
django.db.utils .IntegrityError: NOT NULL constraint failed: blog_ blog.author_ ID error resolution
I am learning django these days, the project is to do my own blog, and then the shell command to create a new blog when the following error
django.db.utils.IntegrityError: NOT NULL constraint failed: blog_blog.author_id
is known from the error message that the non-null constraint of the database is the problem, and it is in blog.auther_id that the problem is
and then look at my creation process, first go back to my models model, the source code is as follows
from django.db import models
from django.contrib.auth.models import User
# 创建博客分类模型
class BlogType(models.Model):
type_name = models.CharField(max_length=15)
def __str__(self):
return self.type_name
# 创建博客模型
class Blog(models.Model):
title = models.CharField(max_length=50)
blog_type = models.ForeignKey(BlogType, on_delete=models.DO_NOTHING)
content = models.TextField()
author = models.ForeignKey(User, on_delete=models.DO_NOTHING)
created_time = models.DateTimeField(null=True, auto_now_add=True)
last_updated_time = models.DateTimeField(null=True, auto_now=True)
def __str__(self):
return "<Blog: %s>" % self.title
can tell me the foreign key I used in the author, and the author class I didn’t define in the model, so my shell code is as follows:
> > > from django.contrib.auth.models import User
> > > User.objects.all()
< QuerySet [<User: xxz>] >
> > > blog.auther = User.objects.all()[0]
> > > blog.save()
sqlite3.IntegrityError: NOT NULL constraint failed: blog_blog.author_id
and then there’s the problem, and the solution to that is very simple, is just to type
again
> > > blog.author_id = 1
> > > blog.save()
problem solved, so now let’s talk about how the problem came to be
p>
https://docs.djangoproject.com/en/1.11/ref/models/instances/
here in the django document is the sentence
Model. code>
pk code> ¶ p>
Regardless of whether you define a primary key field yourself, or let Django supply one for you, each model will have a property called pk
. It behaves like a normal attribute on the model, but is actually an alias for whichever attribute is the primary key field for the model. You can read and set this value, just as you would for any other attribute, and it will update the correct field in the model.
translation is
whether you define your own primary key field or let Django provide one for you, each model has a property called pk. It behaves like a normal property on the model, but is actually an alias for an alias that belongs to the model's primary key field. You can read and set this value as you would any other property, and it updates the correct fields in the model.
general meaning is that you defined in the models of all the classes (as a table in the database), there will be a primary key id, every time you create an object, like write blog = blog () above, will automatically assign an id in the blog, and the increment, by the same token, the auther in the blog, to define a id, but not defined before, so this manual are defined.
p>
p>
p>
p>
p>
p>
p>
p>
command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
is when PIP installs mysqlclient, the main error message
is reported
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /root/python/env/djangoblog/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6sotli60/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6sotli60/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-dg9bckvv --python-tag cp36
cwd: /tmp/pip-install-6sotli60/mysqlclient/
Complete output (31 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,4,'final',0) -D__version__=1.4.4 -I/usr/include/mysql -I/usr/include/python3.6m -I/root/python/env/djangoblog/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient, olefile, pyparsing, packaging, Pillow, Pygments, pylint, python-logstash, python-memcached, raven, requests, Unidecode, webencodings, xmltodict, WeRoBot, Whoosh
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /root/python/env/djangoblog/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6sotli60/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6sotli60/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-m68ogl6h/install-record.txt --single-version-externally-managed --compile --install-headers /root/python/env/djangoblog/include/site/python3.6/mysqlclient
cwd: /tmp/pip-install-6sotli60/mysqlclient/
Complete output (31 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,4,'final',0) -D__version__=1.4.4 -I/usr/include/mysql -I/usr/include/python3.6m -I/root/python/env/djangoblog/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /root/python/env/djangoblog/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6sotli60/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6sotli60/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-m68ogl6h/install-record.txt --single-version-externally-managed --compile --install-headers /root/python/env/djangoblog/include/site/python3.6/mysqlclient Check the logs for full command output.
is presumably the absence of a dependent environment
solution:
sudo apt-get update
sudo apt-get install libffi-dev g++ libssl-dev
then run your PIP installation, which should be fine.
reference: click
Command “python setup.py egg_info” failed with error code 1 in /private/var/folders/14/4hz051qx0wqd3
error when installing drf-haystack in MAC virtual environment:
the Command “python setup. Py egg_info” failed with the error code 1 in/private/var/folders/14/4 hz051qx0wqd3_7wygk3gj980000gn/T/PIP – install – 49 azdncl/django – haystack/
p>
before installing django-haystack, install setuptools
pip install setuptools-scm
to install django-haystack.
if the above methods still report errors, you can install certifi and fix the problem
pip install certifi==2017.7.27.1
div>
Django + jQuery get data in the form + Ajax send data
1. Method 1: obtain form data through Jquery$("# corresponding form id). SerializeArray ()
, and directly assign values to $. Ajax
data.
.serializearray () method see jQuery ajax-serializearray () method
this method puts back an array of JSON objects.
$("#postSubmit").click(function () {
let data = $("#postContent").serializeArray();
$.ajax({
url: '/decuhub/home-post-ajax',
method: 'POST',
data: data,
async: true,
success: function (result) {
console.log("post successfully!")
}
})
})
2. The method 2: by $(" # corresponding form form id) serializer () code> to obtain the form data: p>
$("#postSubmit").click(function () {
let data = $("#postContent").serializer();
$.ajax({
url: '/decuhub/home-post-ajax',
method: 'POST',
data: data,
async: true,
success: function (result) {
console.log("post successfully!")
}
})
})
. Method 3:
is not recommended
$("#postSubmit").click(function () {
let postContentForm = $("#postContent").serializeArray();
let data = {};
$.each(postContentForm, function(){
data[this.name] = this.value;
})
$.ajax({
url: '/decuhub/home-post-ajax',
method: 'POST',
data: data,
async: true,
success: function (result) {
console.log("post successfully!")
}
})
})
$.each()
reference jQuery. Each () p b>
Django's request-post
gets
<QueryDict: {'csrfmiddlewaretoken': ['vO34OFZtTj2Bp2ARMlXVJxZQb37CyuWR7ywaDC4QaJhHtcxB4xB9fnb2IOnbQ2AR'], 'content': ['asdfsd']}>
div>
Type error at XXX ‘set’ object is not reversible
Q:
TypeError at /edit_user/ ‘set’ object is not reversed.
error page as shown
as shown, this could be a url. Py urlpatterns file is a collection of the set {}. We just change it to list type [].
then you can redirect the
Django Issues: TypeError: “Settings” object is irreversible
Exception in thread django-main-thread:
Traceback (most recent call last):
File "D:\Python37\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "D:\Python37\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "D:\PyCharm\py_place\djangoSimpleproProject1\venv\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "D:\PyCharm\py_place\djangoSimpleproProject1\venv\lib\site-packages\django\core\management\commands\runserver.py", line 138, in inner_run
handler = self.get_handler(*args, **options)
File "D:\PyCharm\py_place\djangoSimpleproProject1\venv\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "D:\PyCharm\py_place\djangoSimpleproProject1\venv\lib\site-packages\django\core\management\commands\runserver.py", line 65, in get_handler
return get_internal_wsgi_application()
File "D:\PyCharm\py_place\djangoSimpleproProject1\venv\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "D:\PyCharm\py_place\djangoSimpleproProject1\venv\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "D:\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\PyCharm\py_place\djangoSimpleproProject1\djangoSimpleproProject1\wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "D:\PyCharm\py_place\djangoSimpleproProject1\venv\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "D:\PyCharm\py_place\djangoSimpleproProject1\venv\lib\site-packages\django\core\handlers\wsgi.py", line 127, in __init__
self.load_middleware()
File "D:\PyCharm\py_place\djangoSimpleproProject1\venv\lib\site-packages\django\core\handlers\base.py", line 39, in load_middleware
for middleware_path in reversed(settings.MIDDLEWARE):
TypeError: 'set' object is not reversible
focus:
TypeError: 'set' object is not reversible
solution:
in setting. Py, change {} of
to []……
problem is, I haven’t changed
and I’m confused, I’ve seen a lot of big guys’ methods, it’s really just this emmmmmmmmmm
and I can’t figure out