好像我无法让它发挥作用。 "内部服务器错误"我访问网址时会在屏幕上显示。我的工具是python 3.5.1,apache 2.2和django 1.8.7
这是我的/etc/apache2/httpd.conf
WSGIScriptAlias / /var/www/people/people/wsgi.py
WSGIPythonPath /var/www/people:/usr/local/opt/python-3.5.1/lib/python3.5/site-packages
Alias /static/ /var/www/people/static/
<Directory /var/www/people/people>
<Files wsgi.py>
Allow from all
</Files>
</Directory>
<Directory /var/www/people/static>
Allow from all
</Directory>
这是我的wsgi.py
"""
WSGI config for people project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "people.settings")
# os.environ["DJANGO_SETTINGS_MODULE"] = "people.settings"
application = get_wsgi_application()
这是我的apache日志中的错误
mod_wsgi (pid=2732): Target WSGI script '/var/www/people/people/wsgi.py' cannot be loaded as Python module.,
mod_wsgi (pid=2732): Exception occurred processing WSGI script '/var/www/people/people/wsgi.py'.,
Traceback (most recent call last):,
File "/var/www/people/people/wsgi.py", line 12, in <module>,
from django.core.wsgi import get_wsgi_application,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/core/wsgi.py", line 2, in <module>,
from django.core.handlers.wsgi import WSGIHandler,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 11, in <module>,
from django import http,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/http/__init__.py", line 4, in <module>,
from django.http.response import (,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/http/response.py", line 13, in <module>,
from django.core.serializers.json import DjangoJSONEncoder,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/core/serializers/__init__.py", line 24, in <module>,
from django.core.serializers.base import SerializerDoesNotExist,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/core/serializers/base.py", line 6, in <module>,
from django.db import models,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/db/models/__init__.py", line 6, in <module>,
from django.db.models.query import Q, QuerySet, Prefetch # NOQA,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/db/models/query.py", line 16, in <module>,
from django.db.models import sql,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/db/models/sql/__init__.py", line 2, in <module>,
from django.db.models.sql.subqueries import * # NOQA,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/db/models/sql/subqueries.py", line 9, in <module>,
from django.db.models.sql.query import Query,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/db/models/sql/query.py", line 17, in <module>,
from django.db.models.aggregates import Count,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/db/models/aggregates.py", line 5, in <module>,
from django.db.models.expressions import Func, Star,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/db/models/expressions.py", line 7, in <module>,
from django.db.models import fields,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 9, in <module>,
import uuid,
File "/usr/local/opt/python-3.5.1/lib/python3.5/site-packages/uuid.py", line 138,
if not 0 <= time_low < 1<<32L:,
^,
SyntaxError: invalid syntax,
答案 0 :(得分:1)
您安装的uuid库与Python 3不兼容。
然而没有必要,因为Python在Python 2.5之后的标准库中包含了一个uuid模块 - 实际上是同一个软件包的升级版本。卸载该库并将其从requirements.txt中删除。