Hello everyone. I am working on a django project, which runs perfectly at local machine. I changed my wsgi file as pythonanywhere requires and tried to enter the web-site. It gives me an ImportError for urls, which is pretty weird. I tried to debug it following this article, but I didn't succeed: https://help.pythonanywhere.com/pages/DebuggingImportError.
Here is the short description of the Error:
Request Method: GET
Request URL: http://initiativa.pythonanywhere.com/
Django Version: 1.9
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'crispy_forms',
'registration',
'newsletter')
Installed Middleware:
('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')
Traceback:
File "/home/initiativa/.virtualenvs/django19/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
134. resolver_match = resolver.resolve(request.path_info)
File "/home/initiativa/.virtualenvs/django19/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
374. for pattern in self.url_patterns:
File "/home/initiativa/.virtualenvs/django19/local/lib/python2.7/site-packages/django/utils/functional.py" in __get__
33. res = instance.__dict__[self.name] = self.func(instance)
File "/home/initiativa/.virtualenvs/django19/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
417. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/initiativa/.virtualenvs/django19/local/lib/python2.7/site-packages/django/utils/functional.py" in __get__
33. res = instance.__dict__[self.name] = self.func(instance)
File "/home/initiativa/.virtualenvs/django19/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
410. return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
Exception Type: ImportError at /
Exception Value: No module named urls
And here is my wsgi.py code:
import os
import sys
path = '/home/initiativa/trydjango18/src/'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'trydjango18.src.trydjango18.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
And the tree of my app (without statics and templates):
.
├── LICENSE
├── README.md
├── __init__.py
├── __init__.pyc
├── src
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── db.sqlite3
│ ├── db2.sqlite3
│ ├── manage.py
│ ├── newsletter
│ │ ├── __init__.py
│ │ ├── __init__.pyc
│ │ ├── admin.py
│ │ ├── admin.pyc
│ │ ├── forms.py
│ │ ├── forms.pyc
│ │ ├── migrations
│ │ │ ├── 0001_initial.py
│ │ │ ├── 0001_initial.pyc
│ │ │ ├── __init__.py
│ │ │ └── __init__.pyc
│ │ ├── models.py
│ │ ├── models.pyc
│ │ ├── polls_urls.py
│ │ ├── tests.py
│ │ ├── urls.py
│ │ ├── views.py
│ │ └── views.pyc
│ └── trydjango18
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── settings.py
│ ├── settings.pyc
│ ├── urls.py
│ ├── urls.pyc
│ ├── views.py
│ ├── views.pyc
│ ├── wsgi.py
│ └── wsgi.pyc
Did somebody meet the same problem?