Trying to deploy local Django project on Python Anywhere, but receiving an ImportError: No module named 'environ' when running "python manage.py migrate"
File "/home/Dude1983/surfapp/src/surfapp/settings/development.py",line 1, in <module>
from .base import * # NOQA
File "/home/Dude1983/surfapp/src/surfapp/settings/base.py", line 45,in <module>
import environ
ImportError: No module named 'environ'
I've checked the Django versions, both 1.9.5.
My wsgi.py looks like this:
import os
import sys
path = '/home/Dude1983/surfapp/' # use your own username here
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'surfapp.settings.production'
from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())
I'm using the Edge 2 starter template and my settings are located here:
surfapp
│ ├── __init__.py
│ ├── __pycache__
│ │ └── __init__.cpython-35.pyc
│ ├── logger.py
│ ├── settings
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-35.pyc
│ │ │ ├── base.cpython-35.pyc
│ │ │ └── development.cpython-35.pyc
│ │ ├── base.py
│ │ ├── development.py
│ │ ├── local.sample.env
│ │ └── production.py
│ ├── urls.py
│ ├── views.py
│ └── wsgi.py
I have followed the DjangoGirls tutorial here.
Can anyone help me or give me any pointers?
My guess is that the Edge 2 template has some dependencies that aren't installed in the default pythonanywhere system, and that one of them is called "environ".
I would suggest using a virtualenv, and then doing a
pip install -r requirements.txt
(the edge docs are a bit confusing, but they do say, or at least imply, you should be doing a "pip install" like this)
Here are the PythonAnywhere docs on using virtualenvs:
http://help.pythonanywhere.com/pages/VirtualEnvForNewerDjango
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With