1
There’s a project that was sent to me that I’m going to work on.
I created an Environment to move up the project and in the project had the requeriments where I surrounded it.
But when executing the command python manager.py runserver
he’s giving me the error:
Exception Value: cannot import name Recaptchafield
The complete error follows below, as you can see it is in INSTALLED_APPS
Django Version: 1.8.15
Python Version: 2.7.12
Installed Applications:
('Django.contrib.admin',
'Django.contrib.auth',
'Django.contrib.contenttypes',
'Django.contrib.Sessions',
'Django.contrib.messages',
'Django.contrib.staticfiles',
'Django.contrib.sites',
'Django.contrib.flatpages',
'sorl.thumbnail',
'Grappelli.Ashboard',
'Grappelli',
'captcha',
'axes',
'rest_framework',
'rest_framework.authtoken',
'audit')
Installed Middleware:
('Django.middleware.common.Commonmiddleware',
'Django.middleware.csrf.Csrfviewmiddleware',
'Django.contrib.Sessions.middleware.Sessionmiddleware',
'Django.middleware.common.Commonmiddleware',
'Django.middleware.csrf.Csrfviewmiddleware',
'Django.contrib.auth.middleware.Authenticationmiddleware',
'Django.contrib.auth.middleware.Sessionauthenticationmiddleware',
'Django.contrib.messages.middleware.Messagemiddleware',
'Django.middleware.clickjacking.Xframeoptionsmiddleware',
'Django.middleware.security.Securitymiddleware',
'Django.middleware.http.Conditionalgetmiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'Django.middleware.cache.Updatecachemiddleware',
'Django.middleware.cache.Fetchfromcachemiddleware',
'Django.middleware.gzip.Gzipmiddleware',
'axes.middleware.Failedloginmiddleware',
'audit.Currentrequestusermiddleware')
File "/srv/www/vhosts/project/project/interfacepub/Forms.py" in
from captcha.Fields import Recaptchafield
Exception Type: Importerror at /Admin
Exception Value: cannot import name Recaptchafield
Already clear searched for this error on the internet and all the solutions that are there did not solve me. I made the installation via pip
I tried to put in the environment variables and continued giving error:
export PYTHONPATH=$PYTHONPATH/srv/www/vhosts/project/project/lib/python2.7/site-Packages/
Anyone who knows any way to resolve it. Thank you.
Chances are that the changes are being installed in the wrong Python environment. Do you know the path to Python used to run the application? Are you sure it is the same as the command line (
which python
will this last)? Is using virtualenv?– sergiopereira
Then I entered the project folder
/srv/www/vhosts/project/
I gave the command to start Environmentsource ./project/bin/activate
Then I gavewhich python
/srv/www/vhosts/project/project/bin/python
I then believe that this is correct.– Henrique
And it was with this Python that you installed the tutorials?
– sergiopereira