没有名为“ django”的模块(不带Virtualenv)

时间:2018-07-03 09:39:09

标签: python django linux apache

我正在使Django应用程序与Apache mod_wsgi一起使用。以下是我的错误日志:

---------------------------------------------------------------------
[Mon Jul 02 15:20:42.859177 2018] [so:warn] [pid 4046] AH01574: module wsgi_module is already loaded, skipping
[Mon Jul 02 15:20:42.868149 2018] [wsgi:warn] [pid 4047] mod_wsgi: Compiled for Python/3.5.1+.
[Mon Jul 02 15:20:42.868187 2018] [wsgi:warn] [pid 4047] mod_wsgi: Runtime using Python/3.5.2.
[Mon Jul 02 15:20:42.869974 2018] [mpm_prefork:notice] [pid 4047] AH00163: Apache/2.4.33 (Ubuntu) mod_wsgi/4.5.2 Python/3.5.2 configured -- resuming normal operations
[Mon Jul 02 15:20:42.870004 2018] [core:notice] [pid 4047] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jul 02 15:20:46.777714 2018] [wsgi:error] [pid 4051] [client ::1:57828] mod_wsgi (pid=4051): Target WSGI script '/home/pocra/dashboard/dashboard/dashboard/wsgi.py' cannot be loaded as Python module.
[Mon Jul 02 15:20:46.777807 2018] [wsgi:error] [pid 4051] [client ::1:57828] mod_wsgi (pid=4051): Exception occurred processing WSGI script '/home/pocra/dashboard/dashboard/dashboard/wsgi.py'.
[Mon Jul 02 15:20:46.778033 2018] [wsgi:error] [pid 4051] [client ::1:57828] Traceback (most recent call last):
[Mon Jul 02 15:20:46.778164 2018] [wsgi:error] [pid 4051] [client ::1:57828]   File "/home/pocra/dashboard/dashboard/dashboard/wsgi.py", line 12, in <module>
[Mon Jul 02 15:20:46.778207 2018] [wsgi:error] [pid 4051] [client ::1:57828]     from django.core.wsgi import get_wsgi_application
[Mon Jul 02 15:20:46.778245 2018] [wsgi:error] [pid 4051] [client ::1:57828] ImportError: No module named 'django'
[Mon Jul 02 15:20:46.839298 2018] [wsgi:error] [pid 4048] [client ::1:57830] mod_wsgi (pid=4048): Target WSGI script '/home/pocra/dashboard/dashboard/dashboard/wsgi.py' cannot be loaded as Python module., referer: http://localhost/
[Mon Jul 02 15:20:46.839409 2018] [wsgi:error] [pid 4048] [client ::1:57830] mod_wsgi (pid=4048): Exception occurred processing WSGI script '/home/pocra/dashboard/dashboard/dashboard/wsgi.py'., referer: http://localhost/
[Mon Jul 02 15:20:46.839627 2018] [wsgi:error] [pid 4048] [client ::1:57830] Traceback (most recent call last):, referer: http://localhost/
[Mon Jul 02 15:20:46.839658 2018] [wsgi:error] [pid 4048] [client ::1:57830]   File "/home/pocra/dashboard/dashboard/dashboard/wsgi.py", line 12, in <module>, referer: http://localhost/
[Mon Jul 02 15:20:46.839667 2018] [wsgi:error] [pid 4048] [client ::1:57830]     from django.core.wsgi import get_wsgi_application, referer: http://localhost/
[Mon Jul 02 15:20:46.839689 2018] [wsgi:error] [pid 4048] [client ::1:57830] ImportError: No module named 'django', referer: http://localhost/py
---------------------------------------------------------------------

我的wsgi文件配置为:

LoadModule wsgi_module "/home/pocra/.local/lib/python3.5/site-packages/mod_wsgi/server/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so"

WSGIPythonHome "/usr

WSGIScriptAlias / /home/pocra/dashboard/dashboard/dashboard/wsgi.py

WSGIPythonPath /home/pocra/dashboard/dashboard

-----------------------------------------------
<Directory /home/pocra/dashboard/dashboard/dashboard>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
-----------------------------------------------------

我的目录结构是:

dashboard
└── dashboard
    ├── dashboard
    │   ├── __init__.py
    │   ├── __pycache__
    │   │   ├── __init__.cpython-35.pyc
    │   │   ├── settings.cpython-35.pyc
    │   │   ├── urls.cpython-35.pyc
    │   │   └── wsgi.cpython-35.pyc
    │   ├── settings.py
    │   ├── urls.py
    │   └── wsgi.py
    ├── db.sqlite3
    ├── manage.py
    └── polls
        ├── admin.py
        ├── apps.py
        ├── __init__.py
        ├── migrations
        │   └── __init__.py
        ├── models.py
        ├── tests.py
        └── views.py
-----------------------------------------------------------------

我尝试授予仪表板目录权限,还通过install libapache2-mod-wsgi-py3重新安装了mod_wsgi,但错误仍然存​​在。

0 个答案:

没有答案