Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
267 views
in Technique[技术] by (71.8m points)

python - SyntaxError (starred expression) when working with Django/wsgi and Apache2

I've been scratching my head out for a couple days now on how to solve this issue. Decided to throw in the towel and submit my own question.

I'm in charge of website management for my student organization despite not having previous web development experience. The site is running with Django-3.0 and Apache-2.4 on a Debian-8.11 virtual machine. The Django project is able to run python manage.py runserver withtout issue. When connecting to the website when Apache is handeling things, I am given an internal server error, error code 500.

Checking my error logs, I am given the the following:

[#####] [wsgi:error] [pid #####] [remote #####] mod_wsgi (pid=16124): Exception occurred processing WSGI script '/home/prism/website/prism_project/prism_project/wsgi.py'.
[#####] [wsgi:error] [pid #####] [remote #####] Traceback (most recent call last):
[#####] [wsgi:error] [pid #####] [remote #####]   File "/home/prism/website/prism_project/prism_project/wsgi.py", line 12, in <module>
[#####] [wsgi:error] [pid #####] [remote #####]     from django.core.wsgi import get_wsgi_application
[#####] [wsgi:error] [pid #####] [remote #####]   File "/home/prism/miniconda3/lib/python3.7/site-packages/django/core/wsgi.py", line 2, in <module>
[#####] [wsgi:error] [pid #####] [remote #####]     from django.core.handlers.wsgi import WSGIHandler
[#####] [wsgi:error] [pid #####] [remote #####]   File "/home/prism/miniconda3/lib/python3.7/site-packages/django/core/handlers/wsgi.py", line 139
[#####] [wsgi:error] [pid #####] [remote #####]     *response.items(),
[#####] [wsgi:error] [pid #####] [remote #####]                ^
[#####] [wsgi:error] [pid #####] [remote #####] SyntaxError: can use starred expression only as assignment target

In my searches for a potential solution, I am led to believe that the issue is due to the wrong version of python being used. Given the error log, it appears that python2.7 is being used when python3.7 should be instead.

What should be done to correct the python version being utilized?

In case the issue is config related after all, here is a snippet of my apache configurations file.

<Directory /home/prism/website/prism_project/prism_project>
            <Files wsgi.py>
                Require all granted
            </Files>
        </Directory>

        WSGIDaemonProcess prism_project python-home=home/prism/miniconda3/envs/webEnv/lib/python3.8/site-packages/ python-path=/home/prism/miniconda3/lib/python3.7/site-packages/
        WSGIProcessGroup prism_project
        WSGIScriptAlias / /home/prism/website/prism_project/prism_project/wsgi.py

It's possible and even likely I'm just overlooking something simple. If so, my apologies.

question from:https://stackoverflow.com/questions/65598736/syntaxerror-starred-expression-when-working-with-django-wsgi-and-apache2

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...