ImportError:没有名为nocaptcha_recaptcha的模块,但它已安装

时间:2018-05-06 20:32:04

标签: python django

我使用python manage.py runserver在我的电脑上运行此网站。我也在Ubuntu16.04数字海洋液滴上运行,这是唯一运行的站点。

我正在尝试将其加载到另一个运行了许多Python2.7项目的Ubuntu16.04数字海洋服务器上,突然之间我得到了这个ImportError。

我在apache error.log

中收到以下回溯
 mod_wsgi (pid=5404): Target WSGI script '/var/www/crowdfunder/crowdfunder/wsgi.py' cannot be as Python module.
 mod_wsgi (pid=5404): Exception occurred processing WSGI script '/var/www/crowdfunder/crowdfunder/wsgi.py'.
 Traceback (most recent call last):
   File "/var/www/crowdfunder/crowdfunder/wsgi.py", line 16, in <module>
     application = get_wsgi_application()
   File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
     django.setup(set_prefix=False)
   File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
     apps.populate(settings.INSTALLED_APPS)
   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
     app_config = AppConfig.create(entry)
   File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 90, in create
     module = import_module(entry)
   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
     __import__(name)
 ImportError: No module named nocaptcha_recaptcha

我已检查过我的网站包,nocaptcha_recaptcha就在那里。

我想知道我的Apache .conf文件中是否有问题,因为我的虚拟环境是python3.5,但上面的回溯是python2.7。

这是我的.conf文件

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin webmaster@example.co.uk
        ServerName crowdfunder.example.co.uk
        ServerAlias www.crowdfunder.example.co.uk
        DocumentRoot /var/www/crowdfunder
        WSGIDaemonProcess crowdfunder-ssl python-path=/var/www/crowdfunder python-home=/var/www/crowdfunder/env/lib/python3.5/site-packages
        WSGIProcessGroup crowdfunder-ssl
        WSGIScriptAlias / /var/www/crowdfunder/crowdfunder/wsgi.py

        Alias /robots.txt /var/www/crowdfunder/static/robots.txt
        Alias /favicon.ico /var/www/crowdfunder/static/favicon.ico

        Alias /media/ /var/www/crowdfunder/media/
        Alias /static/ /var/www/crowdfunder/static/

        <Directory /var/www/crowdfunder/static>
            Require all granted
        </Directory>

        <Directory /var/www/crowdfunder/media>
            Require all granted
        </Directory>

        <Directory /var/www/crowdfunder/crowdfunder>
            <Files wsgi.py>
                Require all granted
            </Files>
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

    </VirtualHost>
</IfModule>

0 个答案:

没有答案