Python Django Error :
Error : duplicate key value violates unique constraint "auth_permission _pkey"DETAIL: Key (id)=(xxx) already exists.
Solution :
python manage.py sqlsequencereset auth | python manage.py dbshell
Python Django Error :
Error : duplicate key value violates unique constraint "auth_permission _pkey"DETAIL: Key (id)=(xxx) already exists.
Solution :
python manage.py sqlsequencereset auth | python manage.py dbshell
Python Errors while creating virtualenv
ImportError: No module named importlib_metadata
or
AssertionError: importlib-metadata>=0.12; python_version < "3.8" .dist-info directory not found
or
NameError: name 'ModuleNotFoundError' is not defined
Solution :
You need to upgrade pip.
pip install --upgrade --user pip
Once the pip is upgraded, you should not get the error. If you are using pip3 then use pip3 instead of pip in the command.
You can see the solution in the following video.
If you have configured Apache and Nginx both on your server as some php sites are configured in Apache and some Python/Node/Ruby or other sites are configured in Nginx.
If your primary web server is Nginx and you have proxy passed apache from Nginx, the Authorization header error can a common issue you might face.
'Undefined Index Authorization' error comes when Apache is expecting a Authorization token which is not passed to apache. As your primary web server (Port 80) is nginx and you have proxypassed apache in it. All requests which are received by Nginx first then Nginx transfers them to apache.
But Authorization header has different mechanism because this is a header. Nginx receives it but it does not pass it to the apache as it thinks the header is for it. You need to tell nginx to pass it to apache. Now How will you tell it?
The virtualhost which you have configured in Nginx and proxypassed to Apache, add following lines in it.
proxy_pass_request_headers on;
proxy_set_header Authorization $http_authorization;
proxy_pass_header Authorization;
Where 'Authorization' is the name of the header value which has the token which should be passed to the apache.
Now Nginx will pass the Authorization Header Token to Apache and you will not get the similar error again.