Going mad Guys, need help. I'm a django-wannabe, switching from asp.mvc, deploying django 1.8.4 on PA, and getting 'No module named defaults' error. I've checked archives of PytonAnywhere, and yet - the only answer I got is: check if any of used apps isn't throwing the error. So I did. The only apps in my settings.py are:
'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog'
According to stacktrace, error is being thrown in blog.urls (blog/urls.py). And, indeed, when I comment the include('blog.urls.py') from root urls.py file, the error is gone. Going mad, literally. Nothing in files I created contains reference to: django.conf.url.defaults. Locally it works like a charm.
blog/urls.py:
from django.conf.urls import url, patterns
from . import views
urlpatterns = patterns('',
url(r'^$', views.post_list, name='post_list'),
url(r'^post/(?P<id>\d+)/$', views.post_details, name='post_details'),
url(r'^post/new$', views.post_new, name='post_new'),
url(r'^post/(?P<id>\d+)/edit$', views.post_edit, name='post_edit'),
url(r'^post/(?P<id>\d+)/delete$', views.post_delete, name='post_delete'),
url(r'^post/drafts$', views.post_drafts, name='post_drafts'),
url(r'^post/(?P<id>\d+)/publish$', views.post_publish, name='post_publish'),
url(r'^comment/(?P<id>\d+)/approve', views.comment_approve, name='comment_approve'),
url(r'^comment/(?P<id>\d+)/delete', views.comment_delete, name='comment_delete'),
)
Root urls.py:
from django.conf.urls import include, url, patterns
from django.contrib import admin
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/login/$', 'django.contrib.auth.views.login'),
url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
url(r'', include('blog.urls')),
)
Stacktrace says so:
Environment:
Request Method: GET
Request URL: http://g4rr3t.pythonanywhere.com/
Django Version: 1.8.4
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog')
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/g4rr3t/myenv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
119. resolver_match = resolver.resolve(request.path_info)
File "/home/g4rr3t/myenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
366. for pattern in self.url_patterns:
File "/home/g4rr3t/myenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
402. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/g4rr3t/myenv/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
396. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/home/g4rr3t/my_blog/my_blog/urls.py" in <module>
23. url(r'', include('blog.urls')),
File "/home/g4rr3t/myenv/local/lib/python2.7/site-packages/django/conf/urls/__init__.py" in include
33. urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "./blog/urls.py" in <module>
1. from django.conf.urls.defaults import patterns, include, url
Exception Type: ImportError at /
Exception Value: No module named defaults
Any ideas?